1- // Copyright (c) 2020, 2022 , Oracle and/or its affiliates.
1+ // Copyright (c) 2020, 2023 , Oracle and/or its affiliates.
22// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
44package oracle .weblogic .kubernetes ;
@@ -132,7 +132,6 @@ class ItUsabilityOperatorHelmChart {
132132 private final String domain5Uid = "usabdomain5" ;
133133
134134 private final String clusterName = "cluster-1" ;
135- private final int managedServerPort = 8001 ;
136135 private final int replicaCount = 2 ;
137136 private final String adminServerPrefix = "-" + ADMIN_SERVER_NAME_BASE ;
138137 private final String managedServerPrefix = "-" + MANAGED_SERVER_NAME_BASE ;
@@ -141,9 +140,7 @@ class ItUsabilityOperatorHelmChart {
141140 private int replicaCountDomain1 = 2 ;
142141 private int replicaCountDomain2 = 2 ;
143142 private String adminSvcExtRouteHost = null ;
144-
145- // ingress host list
146- private List <String > ingressHostList ;
143+
147144 private static LoggingFacade logger = null ;
148145
149146 /**
@@ -252,7 +249,7 @@ void testDeleteOperatorButNotDomain() {
252249 }
253250 // delete operator
254251 logger .info ("Uninstalling operator" );
255- uninstallOperator (opHelmParams );
252+ uninstallOperatorAndVerify (opHelmParams );
256253 cleanUpSA (opNamespace );
257254 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME , opNamespace );
258255
@@ -337,7 +334,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
337334 }
338335 // delete operator
339336 logger .info ("Uninstalling operator" );
340- uninstallOperator (opHelmParams );
337+ uninstallOperatorAndVerify (opHelmParams );
341338
342339 //install second time
343340 opHelmParams = installOperatorHelmChart (opNamespace , opServiceAccount , false , true , false ,
@@ -363,7 +360,7 @@ void testCreateDeleteCreateOperatorButNotDomain() {
363360 logger .info ("Domain1 scaled to " + replicaCountDomain1 + " servers" );
364361
365362 } finally {
366- uninstallOperator (op1HelmParams );
363+ uninstallOperatorAndVerify (op1HelmParams );
367364 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,opNamespace );
368365 cleanUpSA (opNamespace );
369366 if (!isDomain1Running ) {
@@ -477,7 +474,7 @@ void testAddRemoveDomainNameSpacesOnOperator() {
477474 "operator can still manage domain1, scaling was succeeded for " + managedServerPodName1 );
478475
479476 } finally {
480- uninstallOperator (op1HelmParams );
477+ uninstallOperatorAndVerify (op1HelmParams );
481478 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,op2Namespace );
482479 cleanUpSA (op2Namespace );
483480 if (!isDomain2Running ) {
@@ -521,8 +518,8 @@ void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() {
521518 assertNull (opHelmParam2 ,
522519 "FAILURE: Helm installs operator in the same namespace as first operator installed " );
523520 } finally {
524- uninstallOperator (opHelmParams );
525- uninstallOperator (op2HelmParams );
521+ uninstallOperatorAndVerify (opHelmParams );
522+ uninstallOperatorAndVerify (op2HelmParams );
526523 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,opNamespace );
527524 cleanUpSA (opNamespace );
528525 if (!isDomain1Running ) {
@@ -566,8 +563,8 @@ void testSecondOpSharingSameDomainNamespacesNegativeInstall() {
566563 expectedError ,"failed" , 0 , op2HelmParams , domain2Namespace );
567564 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
568565 } finally {
569- uninstallOperator (opHelmParams );
570- uninstallOperator (op2HelmParams );
566+ uninstallOperatorAndVerify (opHelmParams );
567+ uninstallOperatorAndVerify (op2HelmParams );
571568 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,opNamespace );
572569 cleanUpSA (opNamespace );
573570 cleanUpSA (op2Namespace );
@@ -613,9 +610,9 @@ void testSecondOpSharingSameExternalRestPortNegativeInstall() {
613610 expectedError ,"failed" ,
614611 externalRestHttpsPort , op2HelmParams , domain2Namespace );
615612 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
616- uninstallOperator (op2HelmParams );
613+ uninstallOperatorAndVerify (op2HelmParams );
617614 } finally {
618- uninstallOperator (opHelmParams );
615+ uninstallOperatorAndVerify (opHelmParams );
619616 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,opNamespace );
620617 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,op2Namespace );
621618 cleanUpSA (opNamespace );
@@ -645,7 +642,7 @@ void testNotPreCreatedOpNsCreateOperatorNegativeInstall() {
645642 false , expectedError ,"failed" , 0 , op2HelmParams , domain2Namespace );
646643 assertNull (opHelmParam2 , "FAILURE: Helm installs operator in the same namespace as first operator installed " );
647644 } finally {
648- uninstallOperator (op2HelmParams );
645+ uninstallOperatorAndVerify (op2HelmParams );
649646 }
650647 }
651648
@@ -711,7 +708,7 @@ void testCreateWithEmptyDomainNamespaceInstall() {
711708
712709
713710 } finally {
714- uninstallOperator (op2HelmParams );
711+ uninstallOperatorAndVerify (op2HelmParams );
715712 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,op2Namespace );
716713 cleanUpSA (op2Namespace );
717714 if (!isDomain2Running ) {
@@ -784,7 +781,7 @@ void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() {
784781 assertNotNull (errorMsg , "Expected error message for missing ServiceAccount not found" );
785782 } finally {
786783 //uninstall operator helm chart
787- uninstallOperator (opHelmParams );
784+ uninstallOperatorAndVerify (opHelmParams );
788785 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,op2Namespace );
789786 cleanUpSA (op2Namespace );
790787 }
@@ -891,7 +888,7 @@ void testTwoDomainsInSameNameSpaceOnOperator() {
891888 } catch (Exception ex ) {
892889 logger .info ("Failed to collect operator log" );
893890 }
894- uninstallOperator (op1HelmParams );
891+ uninstallOperatorAndVerify (op1HelmParams );
895892 deleteSecret (TEST_IMAGES_REPO_SECRET_NAME ,op3Namespace );
896893 cleanUpSA (op3Namespace );
897894 }
@@ -1284,4 +1281,15 @@ private void cleanUpDomainSecrets(String domainNamespace) {
12841281 }
12851282 }
12861283 }
1284+
1285+ private void uninstallOperatorAndVerify (HelmParams opHelmParams ) {
1286+ logger .info ("Uninstalling operator" );
1287+ uninstallOperator (opHelmParams );
1288+
1289+ String opNamespace = opHelmParams .getNamespace ();
1290+ // check the operator pod deleted
1291+ String operatorPodName = assertDoesNotThrow (() -> getOperatorPodName (OPERATOR_RELEASE_NAME , opNamespace ),
1292+ "Can't get operator's pod name" );
1293+ checkPodDoesNotExist (operatorPodName , null , opNamespace );
1294+ }
12871295}
0 commit comments