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

NO-JIRA: Switch integration tests to ordered to save time #1823

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ func GenerateTestSuite(suiteSpec SuiteSpec) {
suiteName, err := generateSuiteName(suiteSpec)
Expect(err).ToNot(HaveOccurred())

Describe(suiteName, func() {
Describe(suiteName, Ordered, func() {
var crdOptions envtest.CRDInstallOptions
var crd *apiextensionsv1.CustomResourceDefinition

BeforeEach(func() {
BeforeEach(OncePerOrdered, func() {
Expect(k8sClient).ToNot(BeNil(), "Kuberentes client is not initialised")

crdOptions = envtest.CRDInstallOptions{
Expand All @@ -147,7 +147,9 @@ func GenerateTestSuite(suiteSpec SuiteSpec) {
for _, u := range newUnstructuredsFor(crd) {
Expect(k8sClient.DeleteAllOf(ctx, u, client.InNamespace("default")))
}
})

AfterEach(OncePerOrdered, func() {
// Remove the CRD and wait for it to be removed from the API.
// If we don't wait then subsequent tests may fail.
Expect(envtest.UninstallCRDs(cfg, crdOptions)).ToNot(HaveOccurred())
Expand Down