Skip to content

E2E improvements for claim server side apply#6182

Merged
jbw976 merged 5 commits into
crossplane:mainfrom
jbw976:e2e-fixes
Jan 9, 2025
Merged

E2E improvements for claim server side apply#6182
jbw976 merged 5 commits into
crossplane:mainfrom
jbw976:e2e-fixes

Conversation

@jbw976

@jbw976 jbw976 commented Dec 14, 2024

Copy link
Copy Markdown
Member

Description of your changes

This PR focuses on improving the reliability of the TestPropagateFieldsRemovalToXRAfterUpgrade E2E test. This test has been consistently flaky according to buildpulse and as we mature claim SSA to beta, we want more reliability to be confident in the promotion.

From brainstorming with @negz, the theory is that the claim is being updated before the upgrade to enable SSA is fully completed as described in #6090 (comment). Therefore, we now run some more thorough checks to ensure the upgrade is complete, e.g. the --enable-ssa-claims flag is set and the pod has stayed running for at least 10 seconds.

With these changes, I was able to run the TestPropagateFieldsRemovalToXRAfterUpgrade test overnight in a loop 30 times with 0 failures 🎉

There are also some E2E test README additions from my lessons on running and debugging the tests more easily.

Related to #5656

I have:

  • Read and followed Crossplane's contribution process.
  • Run earthly +reviewable to ensure this PR is ready for review.
  • Added or updated unit tests.
  • Added or updated e2e tests.
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

@jbw976
jbw976 requested a review from a team as a code owner December 14, 2024 18:03
@jbw976
jbw976 requested a review from turkenh December 14, 2024 18:03
@jbw976

jbw976 commented Dec 15, 2024

Copy link
Copy Markdown
Member Author

All 5 E2E suites failed, but none of them were TestPropagateFieldsRemovalToXRAfterUpgrade at least 😅

4/5 of the failures were for TestUsageStandalone. @turkenh is that potentially related to any of the recent changes in:

I'll try to dig a bit, but let me know if you see any immediate obvious clues 🤔

@jbw976

jbw976 commented Dec 15, 2024

Copy link
Copy Markdown
Member Author

Ah, I think I see what's going on here @turkenh, this is probably related to the changes in this PR to bump the sigs.k8s.io/e2e-framework to v0.5.0 😇

In the DeletionBlockedByUsageWebhook check at https://github.com/jbw976/crossplane/blob/e2e-fixes/test/e2e/funcs/feature.go#L1123-L1126, we're expecting the error to have a Prefix of "admission webhook \"nousages.apiextensions.crossplane.io\" denied the request".

But it looks like now the e2e framework appends another error message (failed to decode file "with-by/used.yaml":) in front of that one, so the Prefix check now fails. Maybe I can update this check to no longer expect that error message to be a Prefix, or maybe some other more reliable check...

edit: hehe, this new error message was definitely added in the v0.5.0 release by our good buddy @sttts - man that dude is everywhere lol 😅
kubernetes-sigs/e2e-framework@d1048a4

@negz negz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! Just some style nits - feel free to take them or leave them.

Comment thread test/e2e/funcs/feature.go
Comment on lines +161 to +164
if deadlineExceed(err) {
t.Logf("Deployment %s/%s had running pod that did not change after %s", dp.GetNamespace(), dp.GetName(), since(start))
} else {
t.Errorf("Error while observing pod for deployment %s/%s", dp.GetNamespace(), dp.GetName())
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if deadlineExceed(err) {
t.Logf("Deployment %s/%s had running pod that did not change after %s", dp.GetNamespace(), dp.GetName(), since(start))
} else {
t.Errorf("Error while observing pod for deployment %s/%s", dp.GetNamespace(), dp.GetName())
}
if deadlineExceed(err) {
t.Logf("Deployment %s/%s had running pod that did not change after %s", dp.GetNamespace(), dp.GetName(), since(start))
return ctx
t.Errorf("Error while observing pod for deployment %s/%s", dp.GetNamespace(), dp.GetName())

Style nit: I prefer to return early to reduce nesting where possible. This captures that the "Error while observing..." is kinda the default/catchall case for the block it's in.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yep that's a good pattern and the intent of this block is preserved with an earlier return.

this same type of check was in 3 places, so I updated all 3 in 93f96e6.

Comment thread test/e2e/funcs/feature.go Outdated
Comment on lines +211 to +219
if wantSet && !found {
t.Logf("did not find arg %s within %s", arg, c.Args)
return false, nil
} else if !wantSet && found {
t.Logf("unexpectedly found arg %s within %s", arg, c.Args)
return false, nil
}

return true, nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Style nit: I think this all could be a switch statement.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

made this style change to a switch statement in 93f96e6

@jbw976

jbw976 commented Jan 8, 2025

Copy link
Copy Markdown
Member Author

Thanks for the review @negz! I incorporated your style suggestions in 93f96e6 and we'll see how e2e tests look on this run. If they look good then I'll merge 🙏

@jbw976
jbw976 merged commit 395512a into crossplane:main Jan 9, 2025
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.

2 participants