[OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6612
[OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6612ycombinator merged 9 commits intoelastic:mainfrom
TestOpAMPWithEDOTCollector E2E test#6612Conversation
|
This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
|
|
This pull request is now in conflicts. Could you fix it @ycombinator? 🙏 |
b90f730 to
26d94f5
Compare
26d94f5 to
72e7cbb
Compare
TestOpAMPWithEDOTCollector E2E test
michel-laterman
left a comment
There was a problem hiding this comment.
I just have minor comments
- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the Elastic Agent package can connect to Fleet Server over OpAMP and enroll in .fleet-agents - Extract shared agent download/extract helpers (downloadElasticAgent, extractAgentArchive) into agent_download.go, refactoring the duplicated code from AgentInstallSuite - Fix TestOpAMP: pre-create the bin/ directory before running make otelcontribcol, which requires it to exist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract shared download/extract helpers into agent_download.go with caching (sha512 comparison), FileReplacer, ExtractFilter, and correct chmod after extraction - Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers shared by both OpAMP tests - Rename TestOpAMP → TestOpAMPWithUpstreamCollector - Add TestOpAMPWithEDOTCollector: downloads elastic-agent package, runs elastic-agent otel subcommand, verifies EDOT Collector enrolls in Fleet Server over OpAMP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ctorConfig Update inline comments, simplify writeOpAMPCollectorConfig to take a single configFilePath parameter, and add newlines after Require() statements for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Elaborate on the processExited comment and move the Cleanup block below the early-exit check so the flow reads top-to-bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename "immediate exit" to "early exit" for consistency and update the Cleanup comment now that it is registered after the early-exit check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…wnload.go Move archive extraction out of AgentInstallSuite into standalone functions so both AgentInstallSuite and StandAloneSuite can reuse them. AgentInstallSuite now overwrites the fleet-server binary after extraction instead of during. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ractZip Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks so that missing directory entries in archives surface as test failures rather than being silently papered over (ref: PR elastic#4985). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test instance UIDs, as suggested in review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ry entries The Linux elastic-agent snapshot tar omits explicit directory entries for some paths (e.g. components/certs/), unlike the macOS archive. Restore MkdirAll for regular files and symlinks in extractTar only; extractZip intentionally omits it per PR elastic#4985 review feedback to catch missing directory entries in zip archives we produce ourselves. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3ee8b2b to
2046d17
Compare
|
@Mergifyio backport 9.2 9.3 |
✅ Backports have been createdDetails
Cherry-pick of 5ece964 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Cherry-pick of 5ece964 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
* test(e2e): add EDOT Collector OpAMP E2E test - Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the Elastic Agent package can connect to Fleet Server over OpAMP and enroll in .fleet-agents - Extract shared agent download/extract helpers (downloadElasticAgent, extractAgentArchive) into agent_download.go, refactoring the duplicated code from AgentInstallSuite - Fix TestOpAMP: pre-create the bin/ directory before running make otelcontribcol, which requires it to exist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup - Extract shared download/extract helpers into agent_download.go with caching (sha512 comparison), FileReplacer, ExtractFilter, and correct chmod after extraction - Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers shared by both OpAMP tests - Rename TestOpAMP → TestOpAMPWithUpstreamCollector - Add TestOpAMPWithEDOTCollector: downloads elastic-agent package, runs elastic-agent otel subcommand, verifies EDOT Collector enrolls in Fleet Server over OpAMP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig Update inline comments, simplify writeOpAMPCollectorConfig to take a single configFilePath parameter, and add newlines after Require() statements for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): improve EDOT test readability Elaborate on the processExited comment and move the Cleanup block below the early-exit check so the flow reads top-to-bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): fix stale comments in EDOT test Rename "immediate exit" to "early exit" for consistency and update the Cleanup comment now that it is registered after the early-exit check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): extract standalone extractTar/extractZip into agent_download.go Move archive extraction out of AgentInstallSuite into standalone functions so both AgentInstallSuite and StandAloneSuite can reuse them. AgentInstallSuite now overwrites the fleet-server binary after extraction instead of during. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e): remove implicit parent directory creation in extractTar/extractZip Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks so that missing directory entries in archives surface as test failures rather than being silently papered over (ref: PR #4985). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): replace static instance UIDs with generated UUIDv7s Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test instance UIDs, as suggested in review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 5ece964) # Conflicts: # testing/e2e/stand_alone_test.go
* test(e2e): add EDOT Collector OpAMP E2E test - Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the Elastic Agent package can connect to Fleet Server over OpAMP and enroll in .fleet-agents - Extract shared agent download/extract helpers (downloadElasticAgent, extractAgentArchive) into agent_download.go, refactoring the duplicated code from AgentInstallSuite - Fix TestOpAMP: pre-create the bin/ directory before running make otelcontribcol, which requires it to exist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup - Extract shared download/extract helpers into agent_download.go with caching (sha512 comparison), FileReplacer, ExtractFilter, and correct chmod after extraction - Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers shared by both OpAMP tests - Rename TestOpAMP → TestOpAMPWithUpstreamCollector - Add TestOpAMPWithEDOTCollector: downloads elastic-agent package, runs elastic-agent otel subcommand, verifies EDOT Collector enrolls in Fleet Server over OpAMP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig Update inline comments, simplify writeOpAMPCollectorConfig to take a single configFilePath parameter, and add newlines after Require() statements for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): improve EDOT test readability Elaborate on the processExited comment and move the Cleanup block below the early-exit check so the flow reads top-to-bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): fix stale comments in EDOT test Rename "immediate exit" to "early exit" for consistency and update the Cleanup comment now that it is registered after the early-exit check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): extract standalone extractTar/extractZip into agent_download.go Move archive extraction out of AgentInstallSuite into standalone functions so both AgentInstallSuite and StandAloneSuite can reuse them. AgentInstallSuite now overwrites the fleet-server binary after extraction instead of during. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e): remove implicit parent directory creation in extractTar/extractZip Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks so that missing directory entries in archives surface as test failures rather than being silently papered over (ref: PR #4985). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): replace static instance UIDs with generated UUIDv7s Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test instance UIDs, as suggested in review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 5ece964) # Conflicts: # testing/e2e/stand_alone_test.go
…st (#6664) * [OpAMP] Add `TestOpAMPWithEDOTCollector` E2E test (#6612) * test(e2e): add EDOT Collector OpAMP E2E test - Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the Elastic Agent package can connect to Fleet Server over OpAMP and enroll in .fleet-agents - Extract shared agent download/extract helpers (downloadElasticAgent, extractAgentArchive) into agent_download.go, refactoring the duplicated code from AgentInstallSuite - Fix TestOpAMP: pre-create the bin/ directory before running make otelcontribcol, which requires it to exist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup - Extract shared download/extract helpers into agent_download.go with caching (sha512 comparison), FileReplacer, ExtractFilter, and correct chmod after extraction - Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers shared by both OpAMP tests - Rename TestOpAMP → TestOpAMPWithUpstreamCollector - Add TestOpAMPWithEDOTCollector: downloads elastic-agent package, runs elastic-agent otel subcommand, verifies EDOT Collector enrolls in Fleet Server over OpAMP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig Update inline comments, simplify writeOpAMPCollectorConfig to take a single configFilePath parameter, and add newlines after Require() statements for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): improve EDOT test readability Elaborate on the processExited comment and move the Cleanup block below the early-exit check so the flow reads top-to-bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): fix stale comments in EDOT test Rename "immediate exit" to "early exit" for consistency and update the Cleanup comment now that it is registered after the early-exit check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): extract standalone extractTar/extractZip into agent_download.go Move archive extraction out of AgentInstallSuite into standalone functions so both AgentInstallSuite and StandAloneSuite can reuse them. AgentInstallSuite now overwrites the fleet-server binary after extraction instead of during. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e): remove implicit parent directory creation in extractTar/extractZip Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks so that missing directory entries in archives surface as test failures rather than being silently papered over (ref: PR #4985). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): replace static instance UIDs with generated UUIDv7s Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test instance UIDs, as suggested in review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 5ece964) # Conflicts: # testing/e2e/stand_alone_test.go * Fixing conflicts --------- Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
…st (#6663) * [OpAMP] Add `TestOpAMPWithEDOTCollector` E2E test (#6612) * test(e2e): add EDOT Collector OpAMP E2E test - Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the Elastic Agent package can connect to Fleet Server over OpAMP and enroll in .fleet-agents - Extract shared agent download/extract helpers (downloadElasticAgent, extractAgentArchive) into agent_download.go, refactoring the duplicated code from AgentInstallSuite - Fix TestOpAMP: pre-create the bin/ directory before running make otelcontribcol, which requires it to exist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup - Extract shared download/extract helpers into agent_download.go with caching (sha512 comparison), FileReplacer, ExtractFilter, and correct chmod after extraction - Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers shared by both OpAMP tests - Rename TestOpAMP → TestOpAMPWithUpstreamCollector - Add TestOpAMPWithEDOTCollector: downloads elastic-agent package, runs elastic-agent otel subcommand, verifies EDOT Collector enrolls in Fleet Server over OpAMP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig Update inline comments, simplify writeOpAMPCollectorConfig to take a single configFilePath parameter, and add newlines after Require() statements for readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): improve EDOT test readability Elaborate on the processExited comment and move the Cleanup block below the early-exit check so the flow reads top-to-bottom. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore(e2e): fix stale comments in EDOT test Rename "immediate exit" to "early exit" for consistency and update the Cleanup comment now that it is registered after the early-exit check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): extract standalone extractTar/extractZip into agent_download.go Move archive extraction out of AgentInstallSuite into standalone functions so both AgentInstallSuite and StandAloneSuite can reuse them. AgentInstallSuite now overwrites the fleet-server binary after extraction instead of during. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e): remove implicit parent directory creation in extractTar/extractZip Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks so that missing directory entries in archives surface as test failures rather than being silently papered over (ref: PR #4985). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(e2e): replace static instance UIDs with generated UUIDv7s Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test instance UIDs, as suggested in review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 5ece964) # Conflicts: # testing/e2e/stand_alone_test.go * Fixing conflicts --------- Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Summary
TestOpAMPWithEDOTCollector, an E2E test that downloads the Elastic Agent package, extracts the EDOT Collector binary, runs it viaelastic-agent otel, and verifies it enrolls with Fleet Server over OpAMPstartFleetServerForOpAMPandwriteOpAMPCollectorConfighelpers, used by bothTestOpAMPWithUpstreamCollectorandTestOpAMPWithEDOTCollectorextractTarandextractZipfromAgentInstallSuiteinto standalone functions inagent_download.goso bothAgentInstallSuiteandStandAloneSuitecan reuse themResolves #6394
🤖 Generated with Claude Code