Skip to content

Commit

Permalink
chore(tests): isolates resource reconcile tests (opendatahub-io#1101)
Browse files Browse the repository at this point in the history
Ensures each test case deploys resources in their own namespaces to
avoid sharing state between tests (sometimes unintentionally).

Follow up to opendatahub-io#1098

(cherry picked from commit 67309b6)
  • Loading branch information
bartoszmajsak authored and VaishnaviHire committed Jul 24, 2024
1 parent 3867378 commit f70c585
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: managed-svc
namespace: "test-namespace"
namespace: {{ .TargetNamespace }}
annotations:
opendatahub.io/managed: "true"
test-annotation: "original-value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: unmanaged-svc
namespace: "test-namespace"
namespace: {{ .TargetNamespace }}
annotations:
opendatahub.io/managed: "false"
test-annotation: "original-value"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/features/resources_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = Describe("Applying and updating resources", func() {
BeforeEach(func(ctx context.Context) {
objectCleaner = envtestutil.CreateCleaner(envTestClient, envTest.Config, fixtures.Timeout, fixtures.Interval)

testNamespace = "test-namespace"
testNamespace = envtestutil.AppendRandomNameTo("test-namespace")

var err error
namespace, err = cluster.CreateNamespace(ctx, envTestClient, testNamespace)
Expand Down Expand Up @@ -92,7 +92,7 @@ var _ = Describe("Applying and updating resources", func() {
UsingConfig(envTest.Config).
Managed().
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join(fixtures.BaseDir, "unmanaged-svc.yaml")).
Manifests(path.Join(fixtures.BaseDir, "unmanaged-svc.tmpl.yaml")).
Load()

})
Expand Down Expand Up @@ -156,7 +156,7 @@ var _ = Describe("Applying and updating resources", func() {
For(handler).
UsingConfig(envTest.Config).
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join(fixtures.BaseDir, "managed-svc.yaml")).
Manifests(path.Join(fixtures.BaseDir, "managed-svc.tmpl.yaml")).
Load()
})
Expect(featuresHandler.Apply(ctx)).To(Succeed())
Expand Down

0 comments on commit f70c585

Please sign in to comment.