-
Notifications
You must be signed in to change notification settings - Fork 525
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
systemtest: test apm-server in Fleet mode #4650
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Steps errorsExpand to view the steps failures
|
Codecov Report
@@ Coverage Diff @@
## master #4650 +/- ##
=======================================
Coverage 76.16% 76.16%
=======================================
Files 161 161
Lines 9873 9873
=======================================
Hits 7520 7520
Misses 2353 2353 |
We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional. For the time being we must also inject a custom built elastic-agent binary to disable PGP verification of the apm-server artifact. Once we bundle the apm-server artifact with Elastic Agent we can stop doing this.
33b10ac
to
82f9b31
Compare
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.
Tests are failing for me, any idea?
Waiting for container id 133773e9632f image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
--- FAIL: TestFleetIntegration (80.85s)
fleet_test.go:133:
Error Trace: fleet_test.go:133
Error: Received unexpected error:
context deadline exceeded
failed to start container
github.com/testcontainers/testcontainers-go.GenericContainer
~/.gvm/pkgsets/go1.15/global/pkg/mod/github.com/testcontainers/[email protected]/generic.go:50
github.com/elastic/apm-server/systemtest.(*ElasticAgentContainer).Start
~/apm-server/systemtest/containers.go:407
github.com/elastic/apm-server/systemtest_test.TestFleetIntegration
~/apm-server/systemtest/fleet_test.go:133
testing.tRunner
~/.gvm/gos/go1.15/src/testing/testing.go:1108
runtime.goexit
~/.gvm/gos/go1.15/src/runtime/asm_amd64.s:1374
Test: TestFleetIntegration
FAIL
exit status 1
FAIL github.com/elastic/apm-server/systemtest 82.224s
- Don't create archive in downloads (APM Server is bundled) - DefaultKibanaPort -> KibanaPort
Nope, I'm not seeing any errors here. Pull latest Docker images? Otherwise check the agent logs in the ephemeral Docker container. |
CI is seeing that error now though 🤔 |
Specify the API Key that the agent should use to enroll with Fleet, rather than supplying the Kibana username and password for it to query for a token. Using the latter approach, the agent could end up enrolling with an unrelated policy.
@jalvz I can't be sure that it's the same issue that tripped you and CI up, but I realised that the test never explicitly told the agent to run the policy created. It just worked by accident, when the agent started up and found the right enrollment token. I've reworked the test to specify the enrollment token to use. PTAL |
* systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional.
* systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional.
* systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional.
* systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional. # Conflicts: # systemtest/elasticsearch.go
* systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional. # Conflicts: # systemtest/elasticsearch.go
…: fix missing error check (#4683) | systemtest: compensate for Fleet API bug (#4693) (#4832) * systemtest: test apm-server in Fleet mode (#4650) * systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional. # Conflicts: # systemtest/elasticsearch.go * systemtest: fix missing error check (#4683) * systemtest: compensate for Fleet API bug (#4693) * systemtest: compensate for Fleet API bug elastic/kibana#90544 is causing the system test to respond with 404 Not Found, despite the policy existing and being successfully deleted. Update the test to temporarily expect a 404 response to avoid failing all our builds. Once the Kibana bug is resolved this will start failing, and we can again check that no error is returned.
… fix missing error check (#4683) | systemtest: compensate for Fleet API bug (#4693) (#4831) * systemtest: test apm-server in Fleet mode (#4650) * systemtest: test apm-server in Fleet mode We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes. Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional. # Conflicts: # systemtest/elasticsearch.go * systemtest: fix missing error check (#4683) * systemtest: compensate for Fleet API bug (#4693) * systemtest: compensate for Fleet API bug elastic/kibana#90544 is causing the system test to respond with 404 Not Found, despite the policy existing and being successfully deleted. Update the test to temporarily expect a 404 response to avoid failing all our builds. Once the Kibana bug is resolved this will start failing, and we can again check that no error is returned.
Motivation/summary
Add a system test that runs Elastic Agent in Fleet mode, with a locally built APM Server binary injected into the container. The test adds the "apm" integration package to a new agent policy, waits for elastic-agent to start apm-server, and verifies it is functional.
We run a custom package registry into which the "apm" integration package is bind-mounted from the tree, enabling us to test with unreleased package changes.
For the time being we must also inject a custom built elastic-agent binary to disable PGP verification of the apm-server artifact. Once we bundle the apm-server artifact with Elastic Agent we can stop doing this.
How to test these changes
cd systemtest && go test -run Fleet
Related issues
None.