Skip to content

Commit 13bc138

Browse files
committed
Create OLM upgrade e2e scenario using codeflare SDK
1 parent e3c684c commit 13bc138

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/e2e/olm_upgrade_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,16 @@ func TestMNISTRayClusterUp(t *testing.T) {
4242
test.T().Parallel()
4343
if os.Getenv("RUN_OLM_TESTS") == "true" {
4444
// Create a namespace
45-
namespace := CreateTestNamespaceWithName(test, namespaceName)
45+
namespace = CreateTestNamespaceWithName(test, namespaceName)
4646
test.T().Logf("Created namespace %s successfully", namespace.Name)
4747

48+
// Delete namespace only if test failed
49+
defer func() {
50+
if t.Failed() {
51+
DeleteTestNamespace(test, namespaceName)
52+
}
53+
}()
54+
4855
// Test configuration
4956
config := &corev1.ConfigMap{
5057
TypeMeta: metav1.TypeMeta{
@@ -212,6 +219,9 @@ func TestMnistJobSubmit(t *testing.T) {
212219
test.T().Parallel()
213220
if os.Getenv("RUN_OLM_TESTS") == "true" {
214221

222+
//delete the namespace after test complete
223+
defer DeleteTestNamespace(test, namespaceName)
224+
215225
// Test configuration
216226
config := &corev1.ConfigMap{
217227
TypeMeta: metav1.TypeMeta{
@@ -315,6 +325,7 @@ func TestMnistJobSubmit(t *testing.T) {
315325
// Assert the job has completed successfully
316326
test.Expect(GetJob(test, job.Namespace, job.Name)).
317327
To(WithTransform(ConditionStatus(batchv1.JobComplete), Equal(corev1.ConditionTrue)))
328+
318329
} else {
319330
test.T().Skip("Skipping OLM upgarde test because RUN_OLM_TESTS is not set")
320331
}

0 commit comments

Comments
 (0)