-
Notifications
You must be signed in to change notification settings - Fork 127
[system testing] Implement assertion for expected number of events #960
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
🌐 Coverage report
|
…astic-package into assert_expected_events
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.
Thanks for adding this. System tests are a bit unpredictable by nature, so counting events may be a bit flaky, though I guess we are fine in cases where we control the source events generated.
Could you add a test package that leverages this feature?
Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
I added to |
Sorry, I meant a test package here in |
|
/test |
I've added a (passing) test package To provoke a fail, I changed
to
Which yields the following output in CI test Restoring the value of 100 allows the test to pass. |
Thanks @andrewkroh Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
|
/test |
Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
|
@jsoriano thanks for taking another look and for the feedback. I think the CI issues are resolved. |
|
@jsoriano I believe I need a final ✅ if everything looks ok from your side. |
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.
Sorry for the delay!
What does this PR do?
This PR will enhance
system testingthrough the implementation of an assertion for expected number of events.Checklist
httpjsonintegration package[ ] handle persistence between callsNOT YET REQUIRED[ ] sum events across callsIMPLICITAuthor's Checklist
[ ] cisco_aironet[ ] juniper_junos[ ] kafka_log[ ] zookeeperotherHow to test this PR locally
Pull this branch and install elastic-package with
make installClone
elastic/integrationsConfigure the httpjson (or related) integration as follows
For an http request, consider this example from the
httpjson/genericdata stream'stest-expected-hit-count-config.yml, shown below.The
data_stream.vars.request_urlcorresponds to a test-stub path in the_dev/deploy/docker/files/config.ymlfile.As
assert.hit_countis defined and> 0the system test will only pass the assertion when the number of elements in the top-level array of the JSON body is equal to this value. In this case the assertion requires 4 hits when the actual count will be 3, so the assertion should fail.Run the system tests using
elastic-package test system -vThe test results should include the following line:
Next, amend
assert.hit_countso that this matches the number of elements (3) in the response to the/testexpectedevents/apipath. The test should now pass as followsRelated issues
## Screenshots