@@ -267,7 +267,7 @@ void testDeleteOperatorButNotDomain() {
267267
268268 // delete operator
269269 logger .info ("Uninstalling operator" );
270- uninstallOperator (opHelmParams );
270+ uninstallOperatorAndVerify (opHelmParams );
271271 cleanUpSA (opNamespace );
272272 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
273273
@@ -349,7 +349,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
349349 }
350350 // delete operator
351351 logger .info ("Uninstalling operator" );
352- uninstallOperator (opHelmParams );
352+ uninstallOperatorAndVerify (opHelmParams );
353353
354354 //install second time
355355 opHelmParams = installOperatorHelmChart (opNamespace , opServiceAccount , false , true , false ,
@@ -375,7 +375,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
375375 logger .info ("Domain1 scaled to " + replicaCountDomain1 + " servers" );
376376
377377 } finally {
378- uninstallOperator (op1HelmParams );
378+ uninstallOperatorAndVerify (op1HelmParams );
379379 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
380380 cleanUpSA (opNamespace );
381381 if (!isDomain1Running ) {
@@ -490,7 +490,7 @@ void testAddRemoveDomainNameSpacesOnOperator() {
490490 "operator can still manage domain3, scaling was succeeded for " + managedServerPodName1 );
491491
492492 } finally {
493- uninstallOperator (op1HelmParams );
493+ uninstallOperatorAndVerify (op1HelmParams );
494494 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
495495 cleanUpSA (op2Namespace );
496496 if (!isDomain2Running ) {
@@ -534,8 +534,8 @@ void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() {
534534 assertNull (opHelmParam2 ,
535535 "FAILURE: Helm installs operator in the same namespace as first operator installed " );
536536 } finally {
537- uninstallOperator (opHelmParams );
538- uninstallOperator (op2HelmParams );
537+ uninstallOperatorAndVerify (opHelmParams );
538+ uninstallOperatorAndVerify (op2HelmParams );
539539 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
540540 cleanUpSA (opNamespace );
541541 if (!isDomain1Running ) {
@@ -579,8 +579,8 @@ void testSecondOpSharingSameDomainNamespacesNegativeInstall() {
579579 expectedError ,"failed" , 0 , op2HelmParams , LIST_STRATEGY , domain2Namespace );
580580 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
581581 } finally {
582- uninstallOperator (opHelmParams );
583- uninstallOperator (op2HelmParams );
582+ uninstallOperatorAndVerify (opHelmParams );
583+ uninstallOperatorAndVerify (op2HelmParams );
584584 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
585585 cleanUpSA (opNamespace );
586586 cleanUpSA (op2Namespace );
@@ -627,9 +627,9 @@ void testSecondOpSharingSameExternalRestPortNegativeInstall() {
627627 expectedError ,"failed" ,
628628 externalRestHttpsPort , op2HelmParams , LIST_STRATEGY , domain2Namespace );
629629 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
630- uninstallOperator (op2HelmParams );
630+ uninstallOperatorAndVerify (op2HelmParams );
631631 } finally {
632- uninstallOperator (opHelmParams );
632+ uninstallOperatorAndVerify (opHelmParams );
633633 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
634634 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
635635 cleanUpSA (opNamespace );
@@ -646,21 +646,22 @@ void testSecondOpSharingSameExternalRestPortNegativeInstall() {
646646 @ DisplayName ("Negative test to try to create the operator with not preexisted namespace" )
647647 void testNotPreCreatedOpNsCreateOperatorNegativeInstall () {
648648 String opReleaseName = OPERATOR_RELEASE_NAME + "2" ;
649+ String nonExistingNamespace = "ns-nonexisting" ;
649650 HelmParams op2HelmParams = new HelmParams ().releaseName (opReleaseName )
650- .namespace ("ns-somens" )
651+ .namespace (nonExistingNamespace )
651652 .chartDir (OPERATOR_CHART_DIR );
652653
653654 // install operator
654655 logger .info ("Installing and verifying operator will fail with expected error message" );
655656 String opServiceAccount = op2Namespace + "-sa2" ;
656657 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 ,
659660 false , expectedError ,"failed" , 0 , op2HelmParams ,
660661 LIST_STRATEGY , domain2Namespace );
661662 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
662663 } finally {
663- uninstallOperator (op2HelmParams );
664+ uninstallOperatorAndVerify (op2HelmParams );
664665 }
665666 }
666667
@@ -727,7 +728,7 @@ void testCreateWithEmptyDomainNamespaceInstall() {
727728 --replicaCountDomain2 ;
728729 logger .info ("Domain2 scaled to " + replicaCountDomain2 + " servers" );
729730 } finally {
730- uninstallOperator (op2HelmParams );
731+ uninstallOperatorAndVerify (op2HelmParams );
731732 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
732733 cleanUpSA (op2Namespace );
733734 if (!isDomain2Running ) {
@@ -802,7 +803,7 @@ void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() {
802803 assertNotNull (errorMsg , "Expected error message for missing ServiceAccount not found" );
803804 } finally {
804805 //uninstall operator helm chart
805- uninstallOperator (opHelmParams );
806+ uninstallOperatorAndVerify (opHelmParams );
806807 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op2Namespace );
807808 cleanUpSA (op2Namespace );
808809 }
@@ -904,7 +905,7 @@ void testTwoDomainsInSameNameSpaceOnOperator() {
904905 } catch (Exception ex ) {
905906 logger .info ("Failed to collect operator log" );
906907 }
907- uninstallOperator (op1HelmParams );
908+ uninstallOperatorAndVerify (op1HelmParams );
908909 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , op3Namespace );
909910 cleanUpSA (op3Namespace );
910911 }
@@ -1295,4 +1296,15 @@ private void cleanUpDomainSecrets(String domainNamespace) {
12951296 }
12961297 }
12971298 }
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+ }
12981310}
0 commit comments