Skip to content

Commit 108d6db

Browse files
awgreenestevekuznetsov
authored andcommitted
Use generated namespaces in e2e tests
This commit updates all of OLM e2e test suites to generate a namespace rather than using a hard coded test namespace passed into the test as a parameter. The motivation for this change include: 1. Decreasing the opportunity for tests to influence each other. Tests are not guaranteed to cleanup after themselves and may influence the results of other tests. 2. Some distributions of OLM run alongside other controllers which may revert changes to resources in predetermined namespaces. Signed-off-by: Alexander Greene <[email protected]>
1 parent 0da1ae2 commit 108d6db

12 files changed

+705
-758
lines changed

test/e2e/catalog_e2e_test.go

+101-101
Large diffs are not rendered by default.

test/e2e/catalog_exclusion_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const magicCatalogDir = "magiccatalog"
2121

2222
var _ = Describe("Global Catalog Exclusion", func() {
2323
var (
24-
testNamespace corev1.Namespace
24+
generatedNamespace corev1.Namespace
2525
determinedE2eClient *util.DeterminedE2EClient
2626
operatorGroup operatorsv1.OperatorGroup
2727
localCatalog *MagicCatalog
@@ -42,7 +42,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
4242
TargetNamespaces: []string{e2eTestNamespace},
4343
},
4444
}
45-
testNamespace = SetupGeneratedTestNamespaceWithOperatorGroup(e2eTestNamespace, operatorGroup)
45+
generatedNamespace = SetupGeneratedTestNamespaceWithOperatorGroup(e2eTestNamespace, operatorGroup)
4646

4747
By("creating a broken catalog in the global namespace")
4848
globalCatalog := &v1alpha1.CatalogSource{
@@ -66,7 +66,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
6666
var err error = nil
6767

6868
fbcPath := filepath.Join(testdataDir, magicCatalogDir, "fbc_initial.yaml")
69-
localCatalog, err = NewMagicCatalogFromFile(determinedE2eClient, testNamespace.GetName(), localCatalogName, fbcPath)
69+
localCatalog, err = NewMagicCatalogFromFile(determinedE2eClient, generatedNamespace.GetName(), localCatalogName, fbcPath)
7070
Expect(err).To(Succeed())
7171

7272
// deploy catalog blocks until the catalog has reached a ready state or fails
@@ -79,7 +79,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
7979
})
8080

8181
AfterEach(func() {
82-
TeardownNamespace(testNamespace.GetName())
82+
TeardownNamespace(generatedNamespace.GetName())
8383
})
8484

8585
When("a subscription referring to the local catalog is created", func() {
@@ -88,7 +88,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
8888
BeforeEach(func() {
8989
subscription = &v1alpha1.Subscription{
9090
ObjectMeta: metav1.ObjectMeta{
91-
Namespace: testNamespace.GetName(),
91+
Namespace: generatedNamespace.GetName(),
9292
Name: genName("local-subscription-"),
9393
},
9494
Spec: &v1alpha1.SubscriptionSpec{

test/e2e/crd_e2e_test.go

+39-38
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)