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

Use generateName for resources created during tests, instead of uuid.NewString() #102

Open
1 task
mlavacca opened this issue Apr 19, 2024 · 2 comments
Open
1 task

Comments

@mlavacca
Copy link
Member

Problem Statement

During our tests, we create multiple resources and use names generated by uuid.NewString(). This makes it quite complex to understand, for example, which resource belongs to which test. We could use the GenerateName field instead, and use the testName (or something similar) as the prefix.

Acceptance Criteria

  • All the uuid.NewString() occurrences for resources created in tests are replaced by GenerateName.
@LiuG-lynx
Copy link

Is it ok to write the resource name directly for individual resources and use the resource name prefix + a random 4-digit string for arrays? @mlavacca

@mlavacca
Copy link
Member Author

Is it ok to write the resource name directly for individual resources and use the resource name prefix + a random 4-digit string for arrays? @mlavacca

I think we should prefer GenerateName instead, to be sure that we avoid name collisions in case tests are run in parallel or some leftovers are in the cluster. When you create a resource, the Create function returns the actual resources, hence you have access to the actual resource name, assigned by the API server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants