Skip to content

[9.2](backport #6611) e2e: extract shared elastic-agent download helpers from AgentInstallSuite#6649

Merged
ycombinator merged 1 commit into9.2from
mergify/bp/9.2/pr-6611
Mar 23, 2026
Merged

[9.2](backport #6611) e2e: extract shared elastic-agent download helpers from AgentInstallSuite#6649
ycombinator merged 1 commit into9.2from
mergify/bp/9.2/pr-6611

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Mar 23, 2026

Summary

  • Extracts downloadElasticAgent, extractAgentArchive, and internal tar/zip helpers from AgentInstallSuite into a new testing/e2e/agent_download.go file so other E2E tests can reuse them without duplication. There will be a follow up PR that adds an E2E test for [OpAMP][E2E Test] Verify that EDOT Collectors can talk to Fleet over OpAMP #6394, and that test will also need to download Elastic Agent / EDOT Collector.
  • Adds download caching: the archive is stored in os.UserCacheDir()/fleet-server-e2e/ and reused on subsequent runs if the remote .sha512 checksum matches, avoiding repeated 600 MB downloads
  • AgentInstallSuite updated to call the shared helpers; behaviour is unchanged

🤖 Generated with Claude Code


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

@ycombinator ycombinator enabled auto-merge (squash) March 23, 2026 18:06
…uite (#6611)

* e2e: extract shared elastic-agent download helpers from AgentInstallSuite

Extract downloadElasticAgent, extractAgentArchive (and internal tar/zip
helpers) into a new agent_download.go file so they can be reused by other
E2E tests without duplication.

Improvements over the original inline methods:
- Caching: the downloaded archive is stored in os.UserCacheDir() and
  reused on subsequent runs if the remote .sha512 checksum matches,
  avoiding repeated 600 MB downloads
- ExtractFilter callback: lets callers limit which entries are written to
  disk (complementing the existing FileReplacer)
- Explicit chmod after extraction: ensures execute bits are preserved
  regardless of the process umask

AgentInstallSuite is updated to call the shared helpers; behaviour is
unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(e2e): remove FileReplacer abstraction, restore original suite methods

Replace the FileReplacer callback with the original extractZip/extractTar/copyFleetServer
suite methods on AgentInstallSuite, matching the pre-refactor approach. The shared
downloadElasticAgent function (with caching) remains in agent_download.go.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(e2e): use os.TempDir() instead of os.UserCacheDir() for agent cache

Avoids persistent cache growth in ~/Library/Caches (macOS) or ~/.cache (Linux).
TempDir is cleared on reboot and is appropriate for CI/test artifacts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): preserve commented-out Artifact fields from pre-refactor code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): restore comments removed during refactor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): restore "Use local fleet-server" comment in extractTar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): gofmt fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): remove !requirefips build tag from agent_download.go

The download helpers contain nothing FIPS-specific; removing the tag
allows them to be used by any e2e test regardless of FIPS stance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update testing/e2e/agent_download.go

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>

* Update testing/e2e/agent_download.go

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>

* Update testing/e2e/agent_download.go

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>

* Update testing/e2e/agent_download.go

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>

* Update testing/e2e/agent_download.go

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>

* chore(e2e): check artifacts API HTTP status before decoding response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): check sha512 fetch HTTP status before reading response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
(cherry picked from commit 3c2c3c2)
@ycombinator ycombinator force-pushed the mergify/bp/9.2/pr-6611 branch from 6c58843 to 3fde83d Compare March 23, 2026 19:01
@ycombinator ycombinator merged commit 4885444 into 9.2 Mar 23, 2026
11 checks passed
@ycombinator ycombinator deleted the mergify/bp/9.2/pr-6611 branch March 23, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant