- 
                Notifications
    
You must be signed in to change notification settings  - Fork 107
 
Validate Splunk configuration before creating task #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
        
          
                .vscode/settings.json
              
                Outdated
          
        
      | @@ -0,0 +1,4 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unwanted files
| import java.util.function.Function; | ||
| import java.util.stream.Collectors; | ||
| 
               | 
          ||
| import org.apache.avro.Protocol; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these imports required? If not, please remove them.
| private Map<String, String> taskConfig; | ||
| private Map<String, ConfigValue> values; | ||
| private List<ConfigValue> validations; | ||
| private AbstractClientWrapper hecAb = new HecClientWrapper(); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should have some meaningful name
| } | ||
| 
               | 
          ||
| 
               | 
          ||
| private void validateHealthCheckForSplunkIndexes(final Map<String, String> configs) throws ConfigException { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it validating splunk health?
| private void healthCheckForSplunkHEC(SplunkSinkConnectorConfig connectorConfig, String index) throws ConfigException { | ||
| Header[] headers; | ||
| headers = new Header[1]; | ||
| headers[0] = new BasicHeader("Authorization", String.format("Splunk %s", connectorConfig.splunkToken)); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you define headers as an inline array?
| final HttpPost httpPost = new HttpPost(url); | ||
| httpPost.setHeaders(headers); | ||
| EventBatch batch = new JsonEventBatch(); | ||
| Event event = new JsonEvent("a:a", null); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "a:a" represents?
| ((SplunkSinkConnector) connector).setHecInstance(clientInstance); | ||
| Assertions.assertDoesNotThrow(()->connector.validate(configs)); | ||
| } | ||
| 
               | 
          
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add tests for an invalid host, and invalid SSL configuration(i.e. HTTP request on HTTPS server and vice-versa)?
No description provided.