Skip to content

[OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6612

Merged
ycombinator merged 9 commits intoelastic:mainfrom
ycombinator:e2e-edot-opamp-test
Mar 25, 2026
Merged

[OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6612
ycombinator merged 9 commits intoelastic:mainfrom
ycombinator:e2e-edot-opamp-test

Conversation

@ycombinator
Copy link
Copy Markdown
Contributor

@ycombinator ycombinator commented Mar 18, 2026

Summary

  • Adds TestOpAMPWithEDOTCollector, an E2E test that downloads the Elastic Agent package, extracts the EDOT Collector binary, runs it via elastic-agent otel, and verifies it enrolls with Fleet Server over OpAMP
  • Refactors shared OpAMP test setup into startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers, used by both TestOpAMPWithUpstreamCollector and TestOpAMPWithEDOTCollector
  • Extracts extractTar and extractZip from AgentInstallSuite into standalone functions in agent_download.go so both AgentInstallSuite and StandAloneSuite can reuse them

Resolves #6394

🤖 Generated with Claude Code

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 18, 2026

This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 18, 2026

This pull request is now in conflicts. Could you fix it @ycombinator? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b e2e-edot-opamp-test upstream/e2e-edot-opamp-test
git merge upstream/main
git push upstream e2e-edot-opamp-test

@ycombinator ycombinator force-pushed the e2e-edot-opamp-test branch from b90f730 to 26d94f5 Compare March 18, 2026 17:11
@ycombinator ycombinator force-pushed the e2e-edot-opamp-test branch from 26d94f5 to 72e7cbb Compare March 23, 2026 17:43
@ycombinator ycombinator added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches skip-changelog labels Mar 23, 2026
@ycombinator ycombinator marked this pull request as ready for review March 23, 2026 18:06
@ycombinator ycombinator requested a review from a team as a code owner March 23, 2026 18:06
@ycombinator ycombinator changed the title e2e: add TestOpAMPWithEDOTCollector [OpAMP] Add TestOpAMPWithEDOTCollector E2E test Mar 23, 2026
Copy link
Copy Markdown
Contributor

@michel-laterman michel-laterman left a comment

Choose a reason for hiding this comment

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

I just have minor comments

ycombinator and others added 9 commits March 25, 2026 12:26
- 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>
@ycombinator ycombinator force-pushed the e2e-edot-opamp-test branch from 3ee8b2b to 2046d17 Compare March 25, 2026 19:26
@ycombinator ycombinator merged commit 5ece964 into elastic:main Mar 25, 2026
10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@Mergifyio backport 9.2 9.3

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 25, 2026

backport 9.2 9.3

✅ Backports have been created

Details

Cherry-pick of 5ece964 has failed:

On branch mergify/bp/9.2/pr-6612
Your branch is up to date with 'origin/9.2'.

You are currently cherry-picking commit 5ece964.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   testing/e2e/agent_download.go
	modified:   testing/e2e/agent_install_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   testing/e2e/stand_alone_test.go

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:

On branch mergify/bp/9.3/pr-6612
Your branch is up to date with 'origin/9.3'.

You are currently cherry-picking commit 5ece964.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   testing/e2e/agent_download.go
	modified:   testing/e2e/agent_install_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   testing/e2e/stand_alone_test.go

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

mergify bot pushed a commit that referenced this pull request Mar 25, 2026
* 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
mergify bot pushed a commit that referenced this pull request Mar 25, 2026
* 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
@ycombinator ycombinator deleted the e2e-edot-opamp-test branch March 25, 2026 20:28
ycombinator added a commit that referenced this pull request Mar 26, 2026
…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>
ycombinator added a commit that referenced this pull request Mar 26, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OpAMP][E2E Test] Verify that EDOT Collectors can talk to Fleet over OpAMP

2 participants