-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Tests should use a randomly generated namespace #4629
Comments
+100 to this. |
Also the same way as the Kubernetes e2e tests / conformance tests and it's working great there, so it should also be a good fit for us. |
/help |
@CecileRobertMichon: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
@mboersma hi, are you working on this already? |
@hzliangbin no, please have at it, and thanks! I looked at it briefly and my only thoughts are:
|
@hzliangbin I would suggest to implement it first on a relatively small package to establish the correct way to do it and then post a list like here #4588 (comment) in this issue to give an overview and possibly crowdsource it (your choice). |
@fabriziopandini Based on the results in #5029 (comment) the PRs helped a lot to make the tests repeatable on a consistently running kind cluster. WDYT about opening a follow-up issue to do the same for other global resources (according to my tests in the linked comment we have the same issue in a few tests which use hard-coded node names) |
@sbueringer global resources (like nodes, CRDs, etc) or things generated by other components (like Kubeadm config maps or CoreDNS config map) are not good candidates for this effort, but I'm +1 to apply similar changes whenever possible or at least let's make sure we do a proper cleanup after each test |
Yup, I would highly recommend a well-scoped follow-up issue. I think we can figure out where we have the most issue when running the tests repeatedly against a kind cluster. So far the main problems seem to be:
|
I'll take a closer look later today and probably close this issue and open a follow-up issue. |
I went through the repo and grepped for "default" and "NamespaceDefault". It looks like we now only use the default namespace in combination with fake client (as there are ~500 occurrences I didn't look in very close detail). I would close this issue as at least the vast majority is fixed. If someone has a concrete example feel free to reopen / open a new issue. As a follow-up I will open an issue (roughly in the next 1-2 weeks) which will focus on "can we run all our tests repeatedly using the same kind cluster". This should catch all cases where cluster-wide resources with a hard-coded name are used (namespaces, nodes, ...). I'll also scope it in a way that we make sure we clean up cluster-wide resources, e.g. currently we leak a lot of nodes with random-generated name. |
/close |
@sbueringer: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What steps did you take and what happened:
In refactoring the unit/integration tests for #4588, we noticed that they use the "default" namespace, and not always through the
v1.NamespaceDefault
constant.What did you expect to happen:
We should review and unify the use of namespaces in the tests so that each uses a randomly-generated namespace to avoid collision, and so we are not polluting the
default
namespace. See comments here.Anything else you would like to add:
Environment:
/kind bug
/area testing
The text was updated successfully, but these errors were encountered: