[9.2](backport #6611) e2e: extract shared elastic-agent download helpers from AgentInstallSuite#6649
Merged
ycombinator merged 1 commit into9.2from Mar 23, 2026
Merged
Conversation
ycombinator
approved these changes
Mar 23, 2026
…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)
6c58843 to
3fde83d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
downloadElasticAgent,extractAgentArchive, and internal tar/zip helpers fromAgentInstallSuiteinto a newtesting/e2e/agent_download.gofile 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.os.UserCacheDir()/fleet-server-e2e/and reused on subsequent runs if the remote.sha512checksum matches, avoiding repeated 600 MB downloadsAgentInstallSuiteupdated to call the shared helpers; behaviour is unchanged🤖 Generated with Claude Code
This is an automatic backport of pull request #6611 done by Mergify.