Skip to content

Commit a4b9101

Browse files
awgreenetmshort
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]> Upstream-repository: operator-lifecycle-manager Upstream-commit: 108d6db0d11d5224214904c02e91391b0aada286
1 parent 9c6f484 commit a4b9101

12 files changed

+705
-758
lines changed

staging/operator-lifecycle-manager/test/e2e/catalog_e2e_test.go

Lines changed: 101 additions & 101 deletions
Large diffs are not rendered by default.

staging/operator-lifecycle-manager/test/e2e/catalog_exclusion_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const magicCatalogDir = "magiccatalog"
2222

2323
var _ = Describe("Global Catalog Exclusion", func() {
2424
var (
25-
testNamespace corev1.Namespace
25+
generatedNamespace corev1.Namespace
2626
determinedE2eClient *util.DeterminedE2EClient
2727
operatorGroup operatorsv1.OperatorGroup
2828
localCatalog *MagicCatalog
@@ -43,7 +43,7 @@ var _ = Describe("Global Catalog Exclusion", func() {
4343
TargetNamespaces: []string{e2eTestNamespace},
4444
},
4545
}
46-
testNamespace = SetupGeneratedTestNamespaceWithOperatorGroup(e2eTestNamespace, operatorGroup)
46+
generatedNamespace = SetupGeneratedTestNamespaceWithOperatorGroup(e2eTestNamespace, operatorGroup)
4747

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

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

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

8282
AfterEach(func() {
83-
TeardownNamespace(testNamespace.GetName())
83+
TeardownNamespace(generatedNamespace.GetName())
8484
})
8585

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

staging/operator-lifecycle-manager/test/e2e/crd_e2e_test.go

Lines changed: 39 additions & 38 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)