Skip to content

Conversation

jryb
Copy link
Contributor

@jryb jryb commented Oct 5, 2020

  • Add test utils for running searches against Splunk instances
  • Add test utils for creating and ingesting log files
  • Add test suite that ingests a log and searches it

Verify that new smoke tests pass.

@jryb jryb marked this pull request as ready for review October 6, 2020 17:13
@jryb jryb closed this Oct 6, 2020
@jryb jryb reopened this Oct 6, 2020
@jryb jryb force-pushed the ingest_search_test_utils branch 2 times, most recently from f789ad7 to e94882b Compare October 6, 2020 23:01
@jryb jryb force-pushed the ingest_search_test_utils branch 3 times, most recently from d0e634f to fdef186 Compare October 23, 2020 05:43
@jryb jryb force-pushed the ingest_search_test_utils branch 2 times, most recently from 8ad6170 to 80b6d2c Compare October 28, 2020 21:33
@jryb jryb force-pushed the ingest_search_test_utils branch from 80b6d2c to ed42c51 Compare October 30, 2020 17:16
@jryb jryb requested a review from kashok-splunk October 30, 2020 19:23
@kashok-splunk
Copy link
Contributor

Looks good. for the future, we can refactor the test suite to make rest calls using HTTP client as we do in src code https://github.com/splunk/splunk-operator/blob/master/pkg/splunk/client/enterprise.go so that we don't need to go through PodExec and we can have consistency between src code and test suite


// ConsistentPollInterval is the interval to use to consistently check a state is stable
ConsistentPollInterval = 200 * time.Millisecond
ConsistentDuration = 2000 * time.Millisecond
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: does it make sense to use ConsistentDuration = 10 * ConsistentPollInterval
Also, i don't see the usage for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are used in the verificationutils.go in StandaloneReady(). I used the values used in all other integration tests for consistency.

@jryb jryb force-pushed the ingest_search_test_utils branch from 6b8ec95 to 5704ab0 Compare October 31, 2020 00:02
username := "admin"
password := "$(cat /mnt/splunk-secrets/password)"

fmt.Fprintf(&searchReqBuilder, "%s %s:%s %s -d output_mode=json -d search=\"search %s\"", curlCmd, username, password, url, search)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably make it a separate function since this is being used multiple places. Something like getSearchCmd(curlCmd, username, password, url, search) or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could but it would only be the same in the PerformSearchReq() and PerformSearchSync() functions since the others are slightly different. Since each search/rest call will have it's own URL and POST data, I'd rather build the command here. Though we could have a flag to switch between the async and sync versions. But then the return values will be different. So probably best to keep them separate, IMO.


// Verify splunk status is up
Eventually(func() splcommon.Phase {
podName := fmt.Sprintf("splunk-%s-standalone-0", deployment.GetName())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can make it a function to get the podname so that it can be used by other tests too such as to get podname for CM or indexer or LM,etc? Something like getPodName("standalone", deployment.GetName()) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya this is how its done in other places in the test code. I just mimicked it here. Maybe we can create a refactor backlog item to take care of this throughout.

var logLine strings.Builder
level := "DEBUG"
component := "GenericComponent"
msg := "This log line is special!"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, good one :)

@jryb jryb force-pushed the ingest_search_test_utils branch from 5704ab0 to e106a31 Compare October 31, 2020 03:54
…k operator

Add test utils for running searchs
Add test utils for creating and ingesting log files
Add test suite that ingests a log and searches it
@jryb jryb force-pushed the ingest_search_test_utils branch from e106a31 to 4a14f06 Compare October 31, 2020 03:57
@jryb jryb requested a review from gaurav-splunk October 31, 2020 04:21
@smohan-splunk smohan-splunk merged commit 3212be6 into develop Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants