Skip to content

Commit ed24af1

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

File tree

2 files changed

+56
-54
lines changed

2 files changed

+56
-54
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,14 @@ public static ExecResult cleanup() throws Exception {
491491

492492
public static ExecResult cleanupDomainResources(String domainUid) throws Exception {
493493
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;
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 "
501+
+ domainUid;
501502
logger.info("Command to call cleanup domain resources script " + cmd);
502503
return ExecCommand.exec(cmd);
503504
}

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

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,10 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
643643
throw new RuntimeException(
644644
"FAILURE: Exception does not report the expected error message " + ex.getMessage());
645645

646-
testCompletedSuccessfully = true;
646+
testCompletedSuccessfully = true;
647647
} finally {
648-
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully)) cleanupDomainResources(domain.getDomainUid());
648+
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully))
649+
cleanupDomainResources(domain.getDomainUid());
649650
if (domainnew != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully))
650651
domainnew.destroy();
651652

@@ -657,50 +658,50 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
657658

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

0 commit comments

Comments
 (0)