e2e: extract shared elastic-agent download helpers from AgentInstallSuite#6611
Merged
ycombinator merged 15 commits intoelastic:mainfrom Mar 23, 2026
Merged
Conversation
Contributor
|
This pull request does not have a backport label. Could you fix it @ycombinator? 🙏
|
…uite 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>
6f69604 to
1ace6df
Compare
…e 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>
…t 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>
…code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
michel-laterman
left a comment
There was a problem hiding this comment.
Mostly nitpicks, but we really should check return status codes before handling the response bodies
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>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
michel-laterman
approved these changes
Mar 23, 2026
Contributor
|
@Mergifyio backport 9.2 9.3 |
Contributor
✅ Backports have been createdDetails
|
mergify Bot
pushed a commit
that referenced
this pull request
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)
mergify Bot
pushed a commit
that referenced
this pull request
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)
ycombinator
added a commit
that referenced
this pull request
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)
ycombinator
added a commit
that referenced
this pull request
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)
ycombinator
added a commit
that referenced
this pull request
Mar 23, 2026
…uite (#6611) (#6650) * 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. * 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. * 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. * chore(e2e): preserve commented-out Artifact fields from pre-refactor code * chore(e2e): restore comments removed during refactor * chore(e2e): restore "Use local fleet-server" comment in extractTar * chore(e2e): gofmt fixes * 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. * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * chore(e2e): check artifacts API HTTP status before decoding response * chore(e2e): check sha512 fetch HTTP status before reading response --------- (cherry picked from commit 3c2c3c2) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
ycombinator
added a commit
that referenced
this pull request
Mar 23, 2026
…uite (#6611) (#6649) * 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. * 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. * 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. * chore(e2e): preserve commented-out Artifact fields from pre-refactor code * chore(e2e): restore comments removed during refactor * chore(e2e): restore "Use local fleet-server" comment in extractTar * chore(e2e): gofmt fixes * 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. * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * Update testing/e2e/agent_download.go * chore(e2e): check artifacts API HTTP status before decoding response * chore(e2e): check sha512 fetch HTTP status before reading response --------- (cherry picked from commit 3c2c3c2) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
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