Skip to content

Commit 1830b6d

Browse files
committed
split test into two methods , added deleteDomainResources method
1 parent a4202db commit 1830b6d

File tree

2 files changed

+63
-16
lines changed

2 files changed

+63
-16
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,19 @@ public static ExecResult cleanup() throws Exception {
489489
return ExecCommand.exec(cmd);
490490
}
491491

492+
public static ExecResult cleanupDomainResources(String domainUid) throws Exception {
493+
String cmd =
494+
"export RESULT_ROOT="
495+
+ getResultRoot()
496+
+ " export PV_ROOT="
497+
+ getPvRoot()
498+
+ " && "
499+
+ getProjectRoot()
500+
+ "/kubernetes/samples/scripts/delete-domain/delete-weblogic-domain-resources.sh -d " + domainUid;
501+
logger.info("Command to call cleanup domain resources script " + cmd);
502+
return ExecCommand.exec(cmd);
503+
}
504+
492505
protected void logTestBegin(String testName) throws Exception {
493506
logger.info("+++++++++++++++++++++++++++++++++---------------------------------+");
494507
logger.info("BEGIN " + testName);

integration-tests/src/test/java/oracle/kubernetes/operator/ITUsabilityOperatorHelmChart.java

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,6 @@ public void testCreateWithEmptyTargetDomainInstall() throws Exception {
553553
logger.info("SUCCESS - " + testMethodName);
554554
}
555555

556-
private void upgradeOperator(Operator operator, String upgradeSet) throws Exception {
557-
Assume.assumeFalse(QUICKTEST);
558-
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
559-
logTestBegin(testMethodName);
560-
operator.callHelmUpgrade(upgradeSet);
561-
logger.info("SUCCESS - " + testMethodName);
562-
}
563-
564556
/**
565557
* Helm installs the operator with default target domains namespaces
566558
*
@@ -593,7 +585,7 @@ public void testCreateWithDefaultTargetDomainInstall() throws Exception {
593585
* Create operator and verify its deployed successfully. Create domain1 and verify domain is
594586
* started. Call helm upgrade to add domainnew to manage, verify both domains are managed by
595587
* operator Call helm upgrade to remove first domain from operator target domains, verify it can't
596-
* not be managed by operator anymore Delete operator and make sure domainnew is still functional
588+
* not be managed by operator anymore
597589
*
598590
* @throws Exception
599591
*/
@@ -650,14 +642,10 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
650642
.contains("Response {\"status\":404,\"detail\":\"/operator/latest/domains/test" + number))
651643
throw new RuntimeException(
652644
"FAILURE: Exception does not report the expected error message " + ex.getMessage());
653-
logger.info("Deleting operator to check that domain functionality is not effected");
654-
operator.destroy();
655-
operator = null;
656-
Thread.sleep(20 * 1000);
657-
domainnew.testWlsLivenessProbe();
658-
testCompletedSuccessfully = true;
645+
646+
testCompletedSuccessfully = true;
659647
} finally {
660-
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully)) domain.destroy();
648+
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully)) cleanupDomainResources(domain.getDomainUid());
661649
if (domainnew != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully))
662650
domainnew.destroy();
663651

@@ -669,4 +657,50 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
669657

670658
logger.info("SUCCESS - " + testMethodName);
671659
}
660+
/**
661+
* Create operator and verify its deployed successfully. Create domain1 and verify domain is
662+
* started. Delete operator and make sure domain1 is still functional
663+
*
664+
* @throws Exception
665+
*/
666+
@Test
667+
public void testDeleteOperatorButNotDomain() throws Exception {
668+
Assume.assumeFalse(QUICKTEST);
669+
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
670+
logTestBegin(testMethodName);
671+
672+
logger.info("Creating Operator & waiting for the script to complete execution");
673+
// create operator
674+
675+
Operator operator = null;
676+
Domain domain = null;
677+
boolean testCompletedSuccessfully = false;
678+
try{
679+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
680+
operator = new Operator(operatorMap, RESTCertType.SELF_SIGNED);
681+
operator.callHelmInstall();
682+
domain = TestUtils.createDomain(TestUtils.createDomainMap(number));
683+
domain.verifyDomainCreated();
684+
testAdminT3Channel(domain);
685+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
686+
logger.info("verify that domain is managed by operator");
687+
operator.verifyDomainExists(domain.getDomainUid());
688+
logger.info("Deleting operator to check that domain functionality is not effected");
689+
operator.destroy();
690+
operator = null;
691+
Thread.sleep(20 * 1000);
692+
domain.testWlsLivenessProbe();
693+
testCompletedSuccessfully = true;
694+
} finally {
695+
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully))
696+
cleanupDomainResources(domain.getDomainUid());
697+
698+
if (operator != null) {
699+
operator.destroy();
700+
}
701+
number++;
702+
}
703+
704+
logger.info("SUCCESS - " + testMethodName);
705+
}
672706
}

0 commit comments

Comments
 (0)