-
Notifications
You must be signed in to change notification settings - Fork 42
chore: refactor Fleet upgrade tests #671
chore: refactor Fleet upgrade tests #671
Conversation
- e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket
This will allow selecting the proper binary, depending if we are using a stale agent or a regular one.
@@ -45,7 +45,7 @@ var agentVersion = agentVersionBase | |||
|
|||
// agentStaleVersion is the version of the agent to use as a base during upgrade | |||
// It can be overriden by ELASTIC_AGENT_STALE_VERSION env var. Using latest GA as a default. | |||
var agentStaleVersion = "7.10.0" | |||
var agentStaleVersion = "7.10.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing version with Jenkinsfile
|
||
return err | ||
cmds := [][]string{ | ||
[]string{"rm", "-fr", "/elastic-agent"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running all Fleet tests in my local machine, I saw multiple errors when moving the agent, because mv
will refuse to rename a directory to another directory if the target directory contains files.
It does not happen on CI but in my local machine happens after multiple runs. I'm adding it defensively, as it's harmless.
@@ -163,7 +163,7 @@ func runElasticAgentCommand(profile string, image string, service string, proces | |||
// be defined by that value | |||
// Else, if the environment variable BEATS_USE_CI_SNAPSHOTS is set, then the artifact | |||
// to be downloaded will be defined by the latest snapshot produced by the Beats CI. | |||
func downloadAgentBinary(artifact string, version string, OS string, arch string, extension string) (string, string, error) { | |||
func downloadAgentBinary(artifact string, version string, OS string, arch string, extension string, stale bool) (string, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an improvement in a follow-up PR, I'm interested in creating a BinaryRequest struct to hold the references needed to download the binary, which would simplify the signature of the method.
💔 Tests Failed
Expand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
|
installerType = fmt.Sprintf("%s-%s", installerType, version) | ||
fts.Installers[fmt.Sprintf("%s-%s", image, installerType)] = i | ||
if fts.Version != agentVersionBackup { | ||
i := GetElasticAgentInstaller(image, installerType, fts.Version, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok i havent tested though. I like the change in installers keys and storing installer per version
The existing test errors are related to the Kibana not being able to start with Elasticsearch |
Same errors as in master. @michalpristas do we merge? |
* chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile
* chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile
* chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile
* chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile
* chore: refactor Fleet upgrade tests (#671) * chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile * fix: update method args
* chore: refactor Fleet upgrade tests (#671) * chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile * fix: update method params
* chore: refactor Fleet upgrade tests (#671) * chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile # Conflicts: # .ci/Jenkinsfile * Update services_test.go
* chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile
…tifacts methods (#689) backport for 6.8.x (#713) * chore: refactor Fleet upgrade tests (#671) * chore: use nightly annotation for the Upgrade tests * chore: add two make goals for the nightly use cases - e2e-fleet-nightly: run the nightly tests not using CI snapshots. It should download the binaries from the official artifactory. - e2e-fleet-nightly-ci-snapshots: run the nightly tests using the CI snapshots for a specific SHA commit from Beats, downloading them from a GCP bucket * chore: bump elastic-agent stale version * chore: pass version and state state when creating an installer This will allow selecting the proper binary, depending if we are using a stale agent or a regular one. * fix: append snapshot to the stale version when using CI snapshots * fix: check for version aliases with non-stale versions * chore: store current agent version in the test suite struct * chore: make sure the layout is properly created for TAR installer * chore: add make goals for testing fleet use cases * chore: move Make goals to the e2e Makefile * chore: refactor build artifacts methods (#689) * feat: use local beats directory for elastic-agent installers * docs: document BEATS_LOCAL_PATH variable * chore: check that the local file exists * chore: add unit tests for the BEATS_LOCAL_PATH variable * chore: simplify logic after test coverage * chore: enrich test name * chore: rename test * chore: move default values to the end of the descriptions * chore: add a helper method to build artifact names * chore: build artifact name only once * chore: pass the entire filename to calculate the GCP bucket coordinates * chore: simplify method signature, as the file name is not changed within the method * chore: use buildArtifactName method * chore: pass filename to helper methods to avoid unnecessary calculations * chore: rename variable for consistency * chore: add license headers * chore: use lowercase comparison for artifact name * chore: build artifact changes from Beats CI to Elastic's artifactory * fix: support building artifact names from local Local builds uses the same as the CI * WIP * fix: rename docker-ubi8 installer key * chore: pass a fallback version when building artifact name In the case we are using a PR , where the version is "pr-12345", then we need to use the base version of the product * chore: remove log * fix: do not override artifact name in Docker installer * feat: support consuming the docker images from snapshots or local in standalone mode * chore: add unit tests for fetching docker images from local Beats repo * chore: apply version to Docker installer * chore: support loading metricbeat image from local repository * chore: exrtact loadImage method to docker helper * feat: support consuming CI artifacts in metricbeat * fix: remove non-existent field from logrus log * chore: extract download logic to helper methods We are discarding the stale parameter, because the stale version is set when the installer is required, so we simply download what is requested * chore: fix typo * chore: check agent version before setting it * chore: use the docker client to load the image instead of the docker binary * chore: add unit tests for check method * chore: pass fallback version to check method * fix: properly calculate version for PRs * chore: move PR check logic to a method * chore: make test independent of maintenance branch # Conflicts: # e2e/_suites/fleet/services_test.go
What does this PR do?
We are refactoring the installer process to support setting the version of the installer package, which will allow us to consume different artifacts at different places of the test suite (i.e. the upgrade test).
@nightly
tag to the upgrade test, so that it's executed in the nightly execution. See feat: support executing nightly tests on CI #669Why is it important?
In one sentence, the main goal is to cover all use cases.
The upgrade test created an installer in the stale state, but the current source code did not know about stale state and always used the
agentVersion
passed as env var, failing the test executions under the use cases described in this PR. Here we are honouring the version of the stale agent, keeping old behavior as it was.Checklist
make notice
in the proper directory)Author's Checklist
How to test this PR locally
These are the tested use cases, as described above:
Related issues
Follow-ups
I'd like to check with the Agent team about the consequences of running the upgrade tests on PRs