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

🌱 Improve E2E ValidateFinalizers and ValidateOwnerRef #10693

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR improves ValidateFinalizers and ValidateOwnerRef so the functions in input can get the namespaced name of the objects being processed.
This allows to handle differently e.g. secrets with CAPI certificate and secrets with cloud provider credentials

/area e2e-testing

@k8s-ci-robot k8s-ci-robot added area/e2e-testing Issues or PRs related to e2e testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 28, 2024
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

In general lgtm so far

@fabriziopandini fabriziopandini added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 28, 2024
@fabriziopandini
Copy link
Member Author

/retest

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

test/e2e/quick_start_test.go Outdated Show resolved Hide resolved
@@ -125,7 +127,11 @@ func getObjectsWithFinalizers(ctx context.Context, proxy ClusterProxy, namespace

if len(setFinalizers) > 0 {
Copy link
Member

@sbueringer sbueringer May 29, 2024

Choose a reason for hiding this comment

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

(I'm aware this was the same before)

This only validates finalizers if there are actually finalizers on the object, which means missing finalizers are accepted

Do I understand it correctly that basically we assume the finalizers are correct the first time we call getObjectsWithFinalizers and then in assertFinalizersExist we would detect if a finalizer is missing compared to the first time we retrieved them?

(So tl;dr: if finalizers are set, we verify that they are the expected ones and in addition we test that they are re-added after we remove them ("resilience"))

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct.
I have noticed this as well and now it should be fixed (we also check for missing finalizers + we check for additional finalizers that can pop up after we remove them)

Copy link
Member

Choose a reason for hiding this comment

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

Thx, nice one!

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

/lgtm
/assign @chrischdi

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 29, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c075fb1da5bac52225f86a72e4239c2746b3ce95

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

One optional nit

/approve

/hold in case you want to change something at the comment

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2024
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

2 similar comments
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-main

@chrischdi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e02c64a1e5aa7422c58921832da8d3c7b014ded7

@sbueringer
Copy link
Member

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 31, 2024
@k8s-ci-robot k8s-ci-robot merged commit ebdda34 into kubernetes-sigs:main May 31, 2024
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone May 31, 2024
@chrischdi
Copy link
Member

chrischdi commented May 31, 2024

Either this or:

Made e2e mink8s fail: https://testgrid.k8s.io/sig-cluster-lifecycle-cluster-api#capi-e2e-mink8s-main

Edit: seemed to be a flake.

@sbueringer
Copy link
Member

GetObjectVariableInto is not used in core CAPI, so in any case this shouldn't lead to any trouble with e2e tests

@fabriziopandini fabriziopandini deleted the improve-E2E-validateFinalizers-and-ownerReferences branch June 4, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/e2e-testing Issues or PRs related to e2e testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants