Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Restructure e2e suites layout #2175

Closed
mdelapenya opened this issue Feb 24, 2022 · 6 comments · Fixed by elastic/elastic-agent#610
Closed

Restructure e2e suites layout #2175

mdelapenya opened this issue Feb 24, 2022 · 6 comments · Fixed by elastic/elastic-agent#610
Labels
area:test Anything related to the Test automation enhancement New feature or request priority:high Product teams are waiting on features to make progress on their roadmap requested-by:Automation size:S less than 1 day Team:Automation Label for the Observability productivity team Team:Elastic-Agent Label for the Agent team triaged Triaged issues will end up in Backlog column in Robots GH Project

Comments

@mdelapenya
Copy link
Contributor

mdelapenya commented Feb 24, 2022

The current state of the Fleet and Beats projects is not represented with the current suite layout. We have fleet, helm and k8s-autodiscover test suites, which can be triggered in isolation, even filtering by cucumber tags. But after having the elastic-agent extracted to a separate repo, then the execution of the suites should be changed in consequence, as it's no longer maintainable without effort: what changes trigger what suite.

This is an initial (and rudimentary) proposal:

  1. the elastic-agent repo should trigger the fleet test suite, plus k8s-autodiscover suite for the elastic-agent

  2. the beats repo should trigger the helm charts test suite, plus k8s-autodiscover suite for not the elastic-agent. I wonder if there should be a case where a change on beats' k8s-autodiscover code should trigger all scenarios for k8s-autodiscover on the e2e. But again, because the elastic-agent project live in another repository, it's not that easy to correlate a commit on beats repo (where the core of the k8s-autodiscover feature lives) with a commit on the elastic-agent repo.

    • we could improve the way to filter the CI execution, which currently support selecting a comma-separated list of suites, adding the ability to include/exclude tags using Cucumber boolean operators for tags.

@jlind23 @ruflin @ph @cmacknz @adam-stokes @elastic/observablt-robots, thoughts?

@mdelapenya mdelapenya added enhancement New feature or request Team:Elastic-Agent Label for the Agent team Team:Automation Label for the Observability productivity team labels Feb 24, 2022
@mdelapenya mdelapenya changed the title Restructure e2e suites Restructure e2e suites layout Feb 24, 2022
@mdelapenya
Copy link
Contributor Author

mdelapenya commented Feb 25, 2022

@v1v we would need to also think about current Beats strategy to trigger there e2e, as it always triggers all suites at the main pipeline, and a subset of them (probably outdated) at the packaging pipeline

@jlind23
Copy link
Contributor

jlind23 commented Feb 28, 2022

@mdelapenya I am quite sure that a change in a single beats can then break the Elastic Agent e2e tests which means that those tests suites should all be triggered.

@mdelapenya
Copy link
Contributor Author

@mdelapenya I am quite sure that a change in a single beats can then break the Elastic Agent e2e tests which means that those tests suites should all be triggered.

Got it, thanks for the clarification.

Now that the elastic-agent is going to live in a separate repository, we have this question: what versions should be used in the e2e? Let me use examples:

commit: repo@sha

When a change in filebeat is committed, identified by `beats@0123456abcdef`
Then the e2e must be executed for filebeat `beats@0123456abcdef` and elastic-agent `elastic-agent@??`
When a change in elastic-agent is committed, identified by `elastic-agent@0123456abcdef`
Then the e2e must be executed for elastic-agent `elastic-agent@0123456abcdef` and beats `beats@??`

An initial (and simple) approach would be using the version of the stack:

  • When beats is modified in main, use the elastic-agent version defined in the main branch for the e2e, which is incrementally modified by the automated bump.
  • When beats is modified in 8.1, use the elastic-agent version defined in the 8.1 branch for the e2e, which is incrementally modified by the automated bump.

and for the agent, the same:

  • When the elastic-agent is modified in main, use the beats version defined in the main branch for the e2e, which is incrementally modified by the automated bump.
  • When the elastic-agent is modified in 8.1, use the beats version defined in the 8.1 branch for the e2e, which is incrementally modified by the automated bump.

@jlind23
Copy link
Contributor

jlind23 commented Feb 28, 2022

Yes you are right. Always use the last commit available on the matching branch seems to be the best option.

@ruflin
Copy link
Member

ruflin commented Feb 28, 2022

+1 that for now we should test latest commit available with matching branch. The main downside is that builds are not fully reproducible. I expect a future where inputs are more decoupled and the testing is more similar done to the way we do it with Elasticsearch where we have a daily PR that updates the dependencies.

@mdelapenya
Copy link
Contributor Author

Ok, with the current implementation provided by #2172, the variables GITHUB_CHECK_SHA1 and GITHUB_CHECK_REPO control what to be tested:

GITHUB_CHECK_SHA1 GITHUB_CHECK_REPO Binaries for elastic-agent Binaries for Beats Use cases
not present (default empty) not present
(default elastic-agent)
Generated for unified release, alongside with stack Generated for unified release, alongside with stack
  • Nightly builds
  • Development of the e2e test project
SHA commit from elastic-agent repo not present
(default elastic-agent)
Generated from Fleet CI, using GCP bucket Generated for unified release, alongside with stack
  • PRs on elastic-agent repo
  • Merge commits on elastic-agent repo
SHA commit from elastic-agent repo elastic-agent Generated from Fleet CI, using GCP bucket Generated for unified release, alongside with stack
  • PRs on elastic-agent repo
  • Merge commits on elastic-agent repo
SHA commit from beats repo beats Generated for unified release, alongside with stack Generated from Beats CI, using GCP bucket
  • PRs on beats repo
  • Merge commits on beats repo

What does "Generated for unified release, alongside with stack" mean?

The project contains a .stack-version file that is automatically bumped with today's hashed snapshot, and this happen per maintenance branch. Because this automation happens in a PR, we know whether the given hashed snapshot is OK or not in terms of passing the e2e. If the tests pass, the bump PR is automatically merged.

With that in mind, a PR on the elastic-agent in the 7.17 branch will use 7.17-LAST_SUCCESSFUL_HASH-SNAPSHOT for the stack, and for the Beats used in scenarios (i.e. installing the agent on top of already running filebeat/metricbeat, or k8s-autodiscover for filebeat). For the scenarios where an elastic-agent must be installed, the binaries for that PR will be used.

What happens with old PRs on beats repo generating elastic-agent artifacts?

This situation happens for PRs created before the repo split, or with old PRs, generating elastic-agent artifacts. We would need to know what to do with them, as it would mean creating corner cases in the automation so that it's possible to consume the artifacts. We intentionally did not cover them to provide support for the new repo for the elastic-agent.

Have more questions?

Please let us know :)

@v1v v1v added priority:high Product teams are waiting on features to make progress on their roadmap size:S less than 1 day triaged Triaged issues will end up in Backlog column in Robots GH Project area:test Anything related to the Test automation requested-by:Automation labels Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:test Anything related to the Test automation enhancement New feature or request priority:high Product teams are waiting on features to make progress on their roadmap requested-by:Automation size:S less than 1 day Team:Automation Label for the Observability productivity team Team:Elastic-Agent Label for the Agent team triaged Triaged issues will end up in Backlog column in Robots GH Project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants