-
Notifications
You must be signed in to change notification settings - Fork 143
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
Fix index pattern when querying ES and condition when searching logs #3765
Conversation
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
This pull request does not have a backport label. Could you fix it @belimawr? 🙏
NOTE: |
bb34c4d
to
94b2ffe
Compare
34790b7
to
621b857
Compare
The failure seems to be caused by: #3664 |
buildkite test this |
eb9d8f3
to
dbb399d
Compare
4603baf
to
31b8184
Compare
The pattern used to query ES was not working on serverless, this commit updates it to a pattern that works on both stateful and serverless.
787f635
to
c1e4f96
Compare
findESDocs now ensures the function returns at least one document. Debug logs are also removed.
c1e4f96
to
ff4edf2
Compare
SonarQube Quality Gate 0 Bugs No Coverage information |
Folks, this PR is finally (well, hopefully) ready for a final review. I found another source of flakiness and fixed it in my last commit ff4edf2. |
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.
Looks good!
…3765) Two issues were causing flakiness on integration tests and are fixed by this PR: 1. The pattern used to query ES was not working on serverless, this commit updates it to a pattern that works on both stateful and serverless as well as make it more specific to the indexes/data streams we want to query 2. `findESDocs` did not wait for the data to be indexed, only to a successful query on ES. In some cases the documents the test wanted were not indexed yet, leading to 0 documents being returned and the test failing with no error in the logs/diagnostics. This is fixed by waiting for a document count > 0 and no error. (cherry picked from commit a03aa9c) # Conflicts: # pkg/testing/tools/estools/elasticsearch.go # testing/integration/logs_ingestion_test.go
…3765) Two issues were causing flakiness on integration tests and are fixed by this PR: 1. The pattern used to query ES was not working on serverless, this commit updates it to a pattern that works on both stateful and serverless as well as make it more specific to the indexes/data streams we want to query 2. `findESDocs` did not wait for the data to be indexed, only to a successful query on ES. In some cases the documents the test wanted were not indexed yet, leading to 0 documents being returned and the test failing with no error in the logs/diagnostics. This is fixed by waiting for a document count > 0 and no error. (cherry picked from commit a03aa9c) # Conflicts: # pkg/testing/tools/estools/elasticsearch.go # testing/integration/logs_ingestion_test.go
…on when searching logs (#3829) Two issues were causing flakiness on integration tests and are fixed by this PR: 1. The pattern used to query ES was not working on serverless, this commit updates it to a pattern that works on both stateful and serverless as well as make it more specific to the indexes/data streams we want to query 2. `findESDocs` did not wait for the data to be indexed, only to a successful query on ES. In some cases the documents the test wanted were not indexed yet, leading to 0 documents being returned and the test failing with no error in the logs/diagnostics. This is fixed by waiting for a document count > 0 and no error. (cherry picked from commit a03aa9c) # Conflicts: # pkg/testing/tools/estools/elasticsearch.go # testing/integration/logs_ingestion_test.go The `add_cloud_metadata` and some other `add_*_metadata` processors are expected to log some errors if they cannot fetch the necessary information. It is normal to find their error logs in pretty much any deployment, some examples: - When Docker is not installed/running `add_docker_metadata` will log some errors - When the Elastic-Agent is deployed in a non-cloud VM `add_cloud_metadata` will log some errors. This commit removes all those processors from the queries for log errors, as they're expected. Add a 2h timeout for `go test` when run on remote hosts. --------- Co-authored-by: Tiago Queiroz <[email protected]>
What does this PR do?
Two issues were causing flakiness on integration tests and are fixed by this PR:
findESDocs
did not wait for the data to be indexed, only to a successful query on ES. In some cases the documents the test wanted were not indexed yet, leading to 0 documents being returned and the test failing with no error in the logs/diagnostics. This is fixed by waiting for a document count > 0 and no error.Why is it important?
It fixes flaky integration tests.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry in./changelog/fragments
using the changelog tool## Author's ChecklistHow to test this PR locally
Run the integration test that was failing with both serverless and stateful
It is needed to clean the deployments because at the moment the integration test framework does not keep track of the type of stack it deployed, more information: #3756
Related issues
## Use cases## Screenshots## LogsQuestions to ask yourself