Skip to content

[OpAMP] Add E2E test#6289

Draft
ycombinator wants to merge 10 commits intoelastic:mainfrom
ycombinator:opamp-e2e-test
Draft

[OpAMP] Add E2E test#6289
ycombinator wants to merge 10 commits intoelastic:mainfrom
ycombinator:opamp-e2e-test

Conversation

@ycombinator
Copy link
Contributor

What is the problem this PR solves?

// Please do not just reference an issue. Explain WHAT the problem this PR solves here.

This PR ensures that an OTel Collector (from an upstream contrib release) is able to successfully connect to Fleet Server over OpAMP. Preliminary OpAMP support was added in Fleet Server in #6270 so this PR here is a follow up to that work.

How does this PR solve the problem?

// Explain HOW you solved the problem in your code. It is possible that during PR reviews this changes and then this section should be updated.

By adding a new E2E test, TestStandAloneRunningSuite/TestOpAMP that downloads and extracts the OTel Collector binary from an upstream contrib release, configures it with the opamp extension, configures Fleet Server to turn on the feature_flags.enable_opamp feature flag, runs the Collector, and verifies that the Collector is connecting to Fleet Server over OpAMP.

How to test this PR locally

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • 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

Related issues

@mergify
Copy link
Contributor

mergify bot commented Feb 4, 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.

ycombinator and others added 8 commits February 9, 2026 13:09
The otelcol-opamp.tpl template accesses {{ .OpAMP.APIKey }} and
{{ .OpAMP.InstanceUID }}, so the template data must nest these under
an "OpAMP" key rather than passing them as flat top-level keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The otelcol config was being written to config.yml, overwriting the
fleet-server config in the same temp dir. Rename it to otelcol.yml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use runtime.GOOS and runtime.GOARCH to build the download URL
dynamically instead of hardcoding darwin_arm64. Also chmod the
extracted binary since extractTarGz doesn't preserve permissions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use explicit Close() instead of defer since resp is reassigned later
in the function, which would cause the deferred close to act on the
wrong response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increase context timeout from 1 to 3 minutes to account for the
otelcol-contrib download. Use defer for cancel() and cmd.Wait() so
cleanup happens even on test failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract instanceUID and apiKey into variables, remove the placeholder
time.Sleep, and start the otelcol-contrib binary with the OpAMP
extension config pointing at fleet-server.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Poll Kibana via AgentIsOnline to confirm the OTel Collector was
enrolled as an agent in Fleet Server after connecting via OpAMP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the hardcoded otelcol-contrib version into otelColContribVersion
in const.go so it can be easily updated in one place.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant