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

test: improve namespace webhook tests #123

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Mar 3, 2024

While working on #121 I noticed some flaky tests I have seen before in previous pull requests. Flakes are annoying, so this PR attempts to improve this somehow.

Since the webhook uses a caching client, the webhook might deny the request based on a non-updated cache. If the test creates a namespace referring to another namespace just created, this can make the test fail. Hopefully, this PR will improve the situation by replacing Except with Eventually in such cases.

I have also added assertions of error messages expected from the webhook for denied requests. This should prevent tests from passing if the request fails for any other reason than the expected. This will force us to update the test if error messages are changed, but I think this makes sense.

@yamatcha yamatcha self-requested a review March 5, 2024 08:32
@yamatcha yamatcha merged commit 2e12aaa into cybozu-go:main Mar 13, 2024
7 checks passed
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.

None yet

2 participants