Skip to content

[9.3](backport #6612) [OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6664

Merged
ycombinator merged 4 commits into9.3from
mergify/bp/9.3/pr-6612
Mar 26, 2026
Merged

[9.3](backport #6612) [OpAMP] Add TestOpAMPWithEDOTCollector E2E test#6664
ycombinator merged 4 commits into9.3from
mergify/bp/9.3/pr-6612

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Mar 25, 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


This is an automatic backport of pull request #6612 done by Mergify.

* 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 mergify bot added the backport label Mar 25, 2026
@mergify mergify bot requested a review from a team as a code owner March 25, 2026 20:21
@mergify mergify bot added the conflicts There is a conflict in the backported pull request label Mar 25, 2026
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Mar 25, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Mar 25, 2026

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

ycombinator
ycombinator previously approved these changes Mar 25, 2026
@ycombinator ycombinator enabled auto-merge (squash) March 25, 2026 20:36
The assertions for agent.type, agent.version, tags, and
policy_revision_idx depend on the field mapping logic from #6400
which has not been backported to 9.3 yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ycombinator ycombinator merged commit fd33a74 into 9.3 Mar 26, 2026
11 checks passed
@ycombinator ycombinator deleted the mergify/bp/9.3/pr-6612 branch March 26, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request 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.

1 participant