Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add controlplane upgrade e2e test using capi framework #845

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

apedriza
Copy link
Contributor

@apedriza apedriza commented Dec 4, 2024

fix #775

This PR makes use of the e2e framework built by CAPI and used by several providers. This is intended to address current problems described in this issue such as code repetition or a proper collection of logs in case of failure. Also, this approach prepares the ground for testing using an agnostic infrastructure provider. By adopting this framework, much of the code required for each test (such as bootstrap management cluster setup) is imported from the CAPI framework. On the other hand, a log dump of all relevant test components logs + configuration used is implemented if the test fails, improving the debugging capability of the test in case of failure.

For now, a basic configuration is sufficient. The intention is to migrate the current CAPI smoke tests little by little from the current approach to the proposed one.

@apedriza apedriza requested a review from a team as a code owner December 4, 2024 17:59
@apedriza apedriza marked this pull request as draft December 4, 2024 17:59
@apedriza apedriza force-pushed the add-capi-e2e-framework branch 17 times, most recently from c81ecf9 to 39692b5 Compare December 13, 2024 17:47
@apedriza apedriza changed the title WIP: Add controlplane e2e test using capi framework Add controlplane upgrade e2e test using capi framework Dec 16, 2024
@apedriza apedriza marked this pull request as ready for review December 16, 2024 10:36
@apedriza apedriza marked this pull request as draft January 24, 2025 11:52
@apedriza apedriza force-pushed the add-capi-e2e-framework branch 4 times, most recently from 2ee12be to 117cc23 Compare February 3, 2025 16:27
@apedriza apedriza marked this pull request as ready for review February 3, 2025 17:03
@apedriza apedriza force-pushed the add-capi-e2e-framework branch from 117cc23 to 2eb46c2 Compare February 3, 2025 17:08
Copy link
Member

@jnummelin jnummelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added couple questions to clarify things

Couple of small fixes IMO needed, looks pretty good in general

.golangci.yml Outdated
@@ -17,4 +17,4 @@ linters:
- gofmt # Checks whether code was gofmt-ed
- goheader # Checks is file headers matche a given pattern
- revive # Stricter drop-in replacement for golint
- ginkgolinter # Enforces standards of using ginkgo and gomega
- ginkgolinter # Enforces standards of using ginkgo and gomega
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need ginkgolinter if we do not implement tests using Ginko?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm I don't know why this diff appears, at the beginning I added some linter-ignoring stuff when ginkgo was added but then I removed it after agree on remove ginkgo. Anyway ginkgolinter was added some time ago probably for this usage: https://github.com/k0sproject/k0smotron/blob/main/internal/controller/k0smotron.io/suite_test.go 👈 I think is scaffolded code from kubebuilder. Doesn't add any value so I think could be removed

Done in 016c67a

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a cluster definition for a single test scenario? If so, Maybe bit more descriptive name for the file and/or some comments in the file would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is a cluster predefined configuration template that can be used by more than one test scenario (using docker infra provider). It is what CAPI refers as "flavor". Another custer-template for some of our tests should be a definition using clusterclass for example. In this case this cluster-template flavor uses is called "OOC" because controlplane is Out-of-Cluster (k0scontrolplane). I can rename this template to cluster-template-k0scontrolplane maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e/data/shared/v1beta1/metadata.yaml Outdated Show resolved Hide resolved
e2e/suite_test.go Outdated Show resolved Hide resolved
e2e/util/controlplane.go Outdated Show resolved Hide resolved
.github/workflows/go.yml Outdated Show resolved Hide resolved
e2e/util/cleanup.go Outdated Show resolved Hide resolved
e2e/workload_cluster_upgrade_test.go Outdated Show resolved Hide resolved
@apedriza apedriza force-pushed the add-capi-e2e-framework branch from ae3a7fd to 6e9350c Compare February 4, 2025 15:10
@apedriza
Copy link
Contributor Author

apedriza commented Feb 4, 2025

@jnummelin thanks for the feedback! Comments addressed. Some of them accidentally lost but addressed too 9c9b3c0

@apedriza apedriza force-pushed the add-capi-e2e-framework branch from 4fb27ea to 9c418b4 Compare February 4, 2025 15:24
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
Signed-off-by: Adrian Pedriza <adripedriza@gmail.com>
@apedriza apedriza force-pushed the add-capi-e2e-framework branch from 9c418b4 to 03ca44f Compare February 5, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor smoke tests
3 participants