-
Notifications
You must be signed in to change notification settings - Fork 276
ref(tests): randomize k8s resource names in tests #4087
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4087 +/- ##
==========================================
- Coverage 69.17% 69.11% -0.07%
==========================================
Files 205 205
Lines 11240 11240
==========================================
- Hits 7775 7768 -7
- Misses 3413 3420 +7
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
be1d6cf
to
ad47dba
Compare
1bdd152
to
b5d300e
Compare
tests/e2e/e2e_certmanager_test.go
Outdated
var ns []string = []string{sourceNs, destNs} | ||
var ( | ||
clientNamespace = framework.RandomName() | ||
serverNamespace = framework.RandomName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could make troubleshooting and investigating a failing test more difficult. Instead of knowing which namespace has which component, the namespaces now will be random strings. Should we perhaps prefix this so that we should be able to distinguish between source/client and destination/server namespaces?
tests/e2e/e2e_certmanager_test.go
Outdated
const destNs = "server" | ||
var ns []string = []string{sourceNs, destNs} | ||
var ( | ||
clientNamespace = framework.RandomName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking have a function RandomNameWithPrefix()
to allowing setting a prefix to the name. The purpose is that, sometimes we can debug on failed tests, and have a way to identify what's each ns for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely went back and forth on that but this is a great idea. Thanks @allenlsy I'll update. cc/ @trstringer
b5d300e
to
1640d96
Compare
Namespace: destName, | ||
Image: "kennethreitz/httpbin", | ||
Ports: []int{80}, | ||
OS: Td.ClusterOS, | ||
}) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
// destNamespace = destName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this?
ServiceName string | ||
ServiceAccountName string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, much needed to avoid setting the same name for namespace, service, and service accounts.
+ Adds a RandomNameWithPrefix(string) func to e2e test framework to more easily generate a random resource name + Modifies helper functions that create resource defs to use random resource names if resource names are not specifically supplied to helpers + includes some cleanup of tests although more is needed in follow up resolves openservicemesh#2953 Signed-off-by: Michelle Noorali <[email protected]>
1640d96
to
bfbe9e9
Compare
more easily generate a random resource name
random resource names if resource names are not specifically
supplied to helpers
follow up
resolves #2953
Signed-off-by: Michelle Noorali [email protected]
Description:
Testing done:
Affected area:
Please answer the following questions with yes/no.
Does this change contain code from or inspired by another project?
Is this a breaking change?