@@ -602,37 +602,26 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
602
602
Domain domain = null ;
603
603
Domain domainnew = null ;
604
604
boolean testCompletedSuccessfully = false ;
605
- logger .info ("kubectl create namespace test" + (number + 1 ));
606
- ExecCommand .exec ("kubectl create namespace test" + (number + 1 ));
607
- logger .info ("create domain with UID : test" + number );
608
- domain = TestUtils .createDomain (TestUtils .createDomainMap (number ));
609
- domain .verifyDomainCreated ();
610
- testAdminT3Channel (domain );
611
- TestUtils .renewK8sClusterLease (getProjectRoot (), getLeaseId ());
612
- logger .info ("verify that domain is managed by operator" );
613
- operator .verifyDomainExists (domain .getDomainUid ());
614
- logger .info ("update operator with new target domain" );
615
- operator .callHelmUpgrade ("domainNamespaces={test" + number + ",test" + (number + 1 ) + "}" );
616
-
617
- ArrayList <String > targetDomainsNS =
618
- (ArrayList <String >) (operator .getOperatorMap ().get ("domainNamespaces" ));
619
- targetDomainsNS .add ("test" + (number + 1 ));
620
- operatorMap .replace ("domainNamespaces" , targetDomainsNS );
621
- domainnew = TestUtils .createDomain (TestUtils .createDomainMap (number + 1 ));
622
- domainnew .verifyDomainCreated ();
623
- testAdminT3Channel (domainnew );
624
- TestUtils .renewK8sClusterLease (getProjectRoot (), getLeaseId ());
625
- logger .info ("verify that new domain is managed by operator after upgrade" );
626
- operator .verifyDomainExists (domainnew .getDomainUid ());
627
- logger .info ("verify that old domain is managed by operator after upgrade" );
628
- operator .verifyDomainExists (domain .getDomainUid ());
629
- logger .info ("Upgrade to remove first domain" );
630
- operator .callHelmUpgrade ("domainNamespaces={test" + (number + 1 ) + "}" );
631
- targetDomainsNS = (ArrayList <String >) (operator .getOperatorMap ().get ("domainNamespaces" ));
632
- targetDomainsNS .remove ("test" + (number ));
633
- operatorMap .replace ("domainNamespaces" , targetDomainsNS );
634
- Thread .sleep (30 * 1000 );
635
605
try {
606
+ logger .info ("kubectl create namespace test" + (number + 1 ));
607
+ ExecCommand .exec ("kubectl create namespace test" + (number + 1 ));
608
+ domain = createVerifyDomain (number , operator );
609
+ logger .info ("update operator with new target domain" );
610
+ operator .callHelmUpgrade ("domainNamespaces={test" + number + ",test" + (number + 1 ) + "}" );
611
+
612
+ ArrayList <String > targetDomainsNS =
613
+ (ArrayList <String >) (operator .getOperatorMap ().get ("domainNamespaces" ));
614
+ targetDomainsNS .add ("test" + (number + 1 ));
615
+ operatorMap .replace ("domainNamespaces" , targetDomainsNS );
616
+ domainnew = createVerifyDomain (number + 1 , operator );
617
+ logger .info ("verify that old domain is managed by operator after upgrade" );
618
+ operator .verifyDomainExists (domain .getDomainUid ());
619
+ logger .info ("Upgrade to remove first domain" );
620
+ operator .callHelmUpgrade ("domainNamespaces={test" + (number + 1 ) + "}" );
621
+ targetDomainsNS = (ArrayList <String >) (operator .getOperatorMap ().get ("domainNamespaces" ));
622
+ targetDomainsNS .remove ("test" + (number ));
623
+ operatorMap .replace ("domainNamespaces" , targetDomainsNS );
624
+ Thread .sleep (30 * 1000 );
636
625
logger .info ("verify that old domain is not managed by operator" );
637
626
operator .verifyDomainExists (domain .getDomainUid ());
638
627
throw new RuntimeException (
@@ -646,7 +635,7 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
646
635
testCompletedSuccessfully = true ;
647
636
} finally {
648
637
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully ))
649
- cleanupDomainResources (domain .getDomainUid ());
638
+ TestUtils . deleteWeblogicDomainResources (domain .getDomainUid ());
650
639
if (domainnew != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully ))
651
640
domainnew .destroy ();
652
641
@@ -680,12 +669,7 @@ public void testDeleteOperatorButNotDomain() throws Exception {
680
669
Map <String , Object > operatorMap = TestUtils .createOperatorMap (number , true );
681
670
operator = new Operator (operatorMap , RESTCertType .SELF_SIGNED );
682
671
operator .callHelmInstall ();
683
- domain = TestUtils .createDomain (TestUtils .createDomainMap (number ));
684
- domain .verifyDomainCreated ();
685
- testAdminT3Channel (domain );
686
- TestUtils .renewK8sClusterLease (getProjectRoot (), getLeaseId ());
687
- logger .info ("verify that domain is managed by operator" );
688
- operator .verifyDomainExists (domain .getDomainUid ());
672
+ domain = createVerifyDomain (number , operator );
689
673
logger .info ("Deleting operator to check that domain functionality is not effected" );
690
674
operator .destroy ();
691
675
operator = null ;
@@ -694,7 +678,7 @@ public void testDeleteOperatorButNotDomain() throws Exception {
694
678
testCompletedSuccessfully = true ;
695
679
} finally {
696
680
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully ))
697
- cleanupDomainResources (domain .getDomainUid ());
681
+ TestUtils . deleteWeblogicDomainResources (domain .getDomainUid ());
698
682
699
683
if (operator != null ) {
700
684
operator .destroy ();
@@ -704,4 +688,15 @@ public void testDeleteOperatorButNotDomain() throws Exception {
704
688
705
689
logger .info ("SUCCESS - " + testMethodName );
706
690
}
691
+
692
+ private Domain createVerifyDomain (int number , Operator operator ) throws Exception {
693
+ logger .info ("create domain with UID : test" + number );
694
+ Domain domain = TestUtils .createDomain (TestUtils .createDomainMap (number ));
695
+ domain .verifyDomainCreated ();
696
+ testAdminT3Channel (domain );
697
+ TestUtils .renewK8sClusterLease (getProjectRoot (), getLeaseId ());
698
+ logger .info ("verify that domain is managed by operator" );
699
+ operator .verifyDomainExists (domain .getDomainUid ());
700
+ return domain ;
701
+ }
707
702
}
0 commit comments