Open justinsb opened 4 days ago
I had something similar months ago(cl) to be able to run fixtures tests by services(and then run multiple services in parallel).
The code looks like(might need revise):
t.Run("fixtures", func(t *testing.T) {
fixtures := resourcefixture.Load(t)
groups := sets.NewString()
for _, fixture := range fixtures {
groups.Insert(fixture.GVK.Group)
}
for _, group := range groups.List() {
group := group
groupTestName := strings.TrimSuffix(group, ".cnrm.cloud.google.com")
t.Run(groupTestName, func(t *testing.T) {
// t.Parallel()
for _, fixture := range fixtures {
if fixture.GVK.Group != group {
continue
}
runTests(ctx, t, fixture, false)
}
})
}
})
This way, we can use the parameter TestAllInSeries/fixtures/logging
to run tests in one service, which would avoid adding an extra environment variable ONLY_TEST_APIGROUP. However, the downside is that we need to always include the service name even when running a single test case, such as TestAllInSeries/fixtures/logging/logginglogmetric
.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from justinsb. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.