@@ -267,7 +267,7 @@ void testDeleteOperatorButNotDomain() {
267
267
268
268
// delete operator
269
269
logger .info ("Uninstalling operator" );
270
- uninstallOperator (opHelmParams );
270
+ uninstallOperatorAndVerify (opHelmParams );
271
271
cleanUpSA (opNamespace );
272
272
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
273
273
@@ -349,7 +349,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
349
349
}
350
350
// delete operator
351
351
logger .info ("Uninstalling operator" );
352
- uninstallOperator (opHelmParams );
352
+ uninstallOperatorAndVerify (opHelmParams );
353
353
354
354
//install second time
355
355
opHelmParams = installOperatorHelmChart (opNamespace , opServiceAccount , false , true , false ,
@@ -375,7 +375,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
375
375
logger .info ("Domain1 scaled to " + replicaCountDomain1 + " servers" );
376
376
377
377
} finally {
378
- uninstallOperator (op1HelmParams );
378
+ uninstallOperatorAndVerify (op1HelmParams );
379
379
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
380
380
cleanUpSA (opNamespace );
381
381
if (!isDomain1Running ) {
@@ -490,7 +490,7 @@ void testAddRemoveDomainNameSpacesOnOperator() {
490
490
"operator can still manage domain3, scaling was succeeded for " + managedServerPodName1 );
491
491
492
492
} finally {
493
- uninstallOperator (op1HelmParams );
493
+ uninstallOperatorAndVerify (op1HelmParams );
494
494
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
495
495
cleanUpSA (op2Namespace );
496
496
if (!isDomain2Running ) {
@@ -534,8 +534,8 @@ void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() {
534
534
assertNull (opHelmParam2 ,
535
535
"FAILURE: Helm installs operator in the same namespace as first operator installed " );
536
536
} finally {
537
- uninstallOperator (opHelmParams );
538
- uninstallOperator (op2HelmParams );
537
+ uninstallOperatorAndVerify (opHelmParams );
538
+ uninstallOperatorAndVerify (op2HelmParams );
539
539
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
540
540
cleanUpSA (opNamespace );
541
541
if (!isDomain1Running ) {
@@ -579,8 +579,8 @@ void testSecondOpSharingSameDomainNamespacesNegativeInstall() {
579
579
expectedError ,"failed" , 0 , op2HelmParams , LIST_STRATEGY , domain2Namespace );
580
580
assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
581
581
} finally {
582
- uninstallOperator (opHelmParams );
583
- uninstallOperator (op2HelmParams );
582
+ uninstallOperatorAndVerify (opHelmParams );
583
+ uninstallOperatorAndVerify (op2HelmParams );
584
584
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
585
585
cleanUpSA (opNamespace );
586
586
cleanUpSA (op2Namespace );
@@ -627,9 +627,9 @@ void testSecondOpSharingSameExternalRestPortNegativeInstall() {
627
627
expectedError ,"failed" ,
628
628
externalRestHttpsPort , op2HelmParams , LIST_STRATEGY , domain2Namespace );
629
629
assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
630
- uninstallOperator (op2HelmParams );
630
+ uninstallOperatorAndVerify (op2HelmParams );
631
631
} finally {
632
- uninstallOperator (opHelmParams );
632
+ uninstallOperatorAndVerify (opHelmParams );
633
633
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
634
634
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
635
635
cleanUpSA (opNamespace );
@@ -646,21 +646,22 @@ void testSecondOpSharingSameExternalRestPortNegativeInstall() {
646
646
@ DisplayName ("Negative test to try to create the operator with not preexisted namespace" )
647
647
void testNotPreCreatedOpNsCreateOperatorNegativeInstall () {
648
648
String opReleaseName = OPERATOR_RELEASE_NAME + "2" ;
649
+ String nonExistingNamespace = "ns-nonexisting" ;
649
650
HelmParams op2HelmParams = new HelmParams ().releaseName (opReleaseName )
650
- .namespace ("ns-somens" )
651
+ .namespace (nonExistingNamespace )
651
652
.chartDir (OPERATOR_CHART_DIR );
652
653
653
654
// install operator
654
655
logger .info ("Installing and verifying operator will fail with expected error message" );
655
656
String opServiceAccount = op2Namespace + "-sa2" ;
656
657
try {
657
- String expectedError = "create: failed to create: namespaces \" ns-somens \" not found" ;
658
- HelmParams opHelmParam2 = installOperatorHelmChart ("ns-somens" , opServiceAccount , false , false ,
658
+ String expectedError = "create: failed to create: namespaces \" " + nonExistingNamespace + " \" not found" ;
659
+ HelmParams opHelmParam2 = installOperatorHelmChart (nonExistingNamespace , opServiceAccount , false , false ,
659
660
false , expectedError ,"failed" , 0 , op2HelmParams ,
660
661
LIST_STRATEGY , domain2Namespace );
661
662
assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
662
663
} finally {
663
- uninstallOperator (op2HelmParams );
664
+ uninstallOperatorAndVerify (op2HelmParams );
664
665
}
665
666
}
666
667
@@ -727,7 +728,7 @@ void testCreateWithEmptyDomainNamespaceInstall() {
727
728
--replicaCountDomain2 ;
728
729
logger .info ("Domain2 scaled to " + replicaCountDomain2 + " servers" );
729
730
} finally {
730
- uninstallOperator (op2HelmParams );
731
+ uninstallOperatorAndVerify (op2HelmParams );
731
732
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
732
733
cleanUpSA (op2Namespace );
733
734
if (!isDomain2Running ) {
@@ -802,7 +803,7 @@ void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() {
802
803
assertNotNull (errorMsg , "Expected error message for missing ServiceAccount not found" );
803
804
} finally {
804
805
//uninstall operator helm chart
805
- uninstallOperator (opHelmParams );
806
+ uninstallOperatorAndVerify (opHelmParams );
806
807
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
807
808
cleanUpSA (op2Namespace );
808
809
}
@@ -904,7 +905,7 @@ void testTwoDomainsInSameNameSpaceOnOperator() {
904
905
} catch (Exception ex ) {
905
906
logger .info ("Failed to collect operator log" );
906
907
}
907
- uninstallOperator (op1HelmParams );
908
+ uninstallOperatorAndVerify (op1HelmParams );
908
909
deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op3Namespace );
909
910
cleanUpSA (op3Namespace );
910
911
}
@@ -1295,4 +1296,15 @@ private void cleanUpDomainSecrets(String domainNamespace) {
1295
1296
}
1296
1297
}
1297
1298
}
1299
+
1300
+ private void uninstallOperatorAndVerify (HelmParams opHelmParams ) {
1301
+ logger .info ("Uninstalling operator" );
1302
+ uninstallOperator (opHelmParams );
1303
+
1304
+ String opNamespace = opHelmParams .getNamespace ();
1305
+ // check the operator pod deleted
1306
+ String operatorPodName = assertDoesNotThrow (() -> getOperatorPodName (OPERATOR_RELEASE_NAME , opNamespace ),
1307
+ "Can't get operator's pod name" );
1308
+ checkPodDoesNotExist (operatorPodName , null , opNamespace );
1309
+ }
1298
1310
}
0 commit comments