Skip to content

Commit a40893e

Browse files
committed
removed sleep calls, corrected Readme
1 parent 8b0b0f9 commit a40893e

File tree

4 files changed

+56
-18
lines changed

4 files changed

+56
-18
lines changed

integration-tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ Basic Use Cases described above are verified in all the domain configurations. A
7777
| Two Operators using same External Https Port | create chart using same https rest port as already running first operator, verify that deployment fails with expected error |
7878
| Two Operators using same target domains namespace | create chart using target domains namespace as already running first operator, verify that deployment fails with expected error |
7979
| Operator Helm Chart using not preexisted target domains namespace | create chart using not preexisted target domains namespace as already running first operator, verify that deployment fails with expected error |
80-
| Operator Helm Chart add/delete target domains namespace ( domain1, domain2) | create chart , use upgrade to add/remove target domains ( domain1,domain2), verify that operator is able to manage added domain (domain2, not able to access the deleted one(domain1) |
81-
| Operator Helm Chart delete operator helm chart, leave domain running | create operator chart and start domain, delete operator, verify domain is still functional |
80+
| Operator Helm Chart add/delete target domain namespaces (domain1, domain2) | create operator helm chart managing domain1, use upgrade to add domain2. Verify that operator is able to manage added domain (domain2). Use helm upgrade to remove domain1, verify that operator not able to manage anymore the deleted one(domain1) |
81+
| Operator Helm Chart delete operator helm chart, leave domain running | create operator helm chart and start domain1, delete operator helm chart, verify domain1 is still functional |
8282

8383

8484
# Directory Configuration and Structure

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

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public class ITUsabilityOperatorHelmChart extends BaseTest {
2121

2222
private static int number = 3;
2323
String oprelease = "op" + number;
24+
private int waitTime = 5;
25+
private int maxIterations = 60;
2426

2527
/**
2628
* This method gets called only once before any of the test methods are executed. It does the
@@ -609,24 +611,16 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
609611
ArrayList<String> targetDomainsNS =
610612
(ArrayList<String>) (operator.getOperatorMap().get("domainNamespaces"));
611613
targetDomainsNS.add("test" + (number + 1));
612-
upgradeVerifyOperatorDomainNamespaces(operator, targetDomainsNS);
614+
upgradeOperatorDomainNamespaces(operator, targetDomainsNS);
613615
domainnew = createVerifyDomain(number + 1, operator);
614616
logger.info("verify that old domain is managed by operator after upgrade");
615-
operator.verifyDomainExists(domain.getDomainUid());
617+
verifyOperatorDomainManagement(operator, domain, true);
616618
logger.info("Upgrade to remove first domain");
617619
targetDomainsNS.remove("test" + (number));
618-
upgradeVerifyOperatorDomainNamespaces(operator, targetDomainsNS);
619-
Thread.sleep(60 * 1000);
620+
upgradeOperatorDomainNamespaces(operator, targetDomainsNS);
620621
logger.info("verify that old domain is not managed by operator");
621-
operator.verifyDomainExists(domain.getDomainUid());
622-
throw new RuntimeException(
623-
"FAILURE: After Helm Upgrade for the domainNamespaces operator still able to manage old namespace ");
624-
} catch (Exception ex) {
625-
if (!ex.getMessage()
626-
.contains("Response {\"status\":404,\"detail\":\"/operator/latest/domains/test" + number))
627-
throw new RuntimeException(
628-
"FAILURE: Exception does not report the expected error message " + ex.getMessage());
629-
622+
verifyOperatorDomainManagement(operator, domain, false);
623+
verifyOperatorDomainManagement(operator, domainnew, true);
630624
testCompletedSuccessfully = true;
631625
} finally {
632626
if (domain != null && !SMOKETEST && (JENKINS || testCompletedSuccessfully))
@@ -639,7 +633,6 @@ public void testAddRemoveDomainUpdateOperatorHC() throws Exception {
639633
}
640634
number++;
641635
}
642-
643636
logger.info("SUCCESS - " + testMethodName);
644637
}
645638
/**
@@ -666,7 +659,6 @@ public void testDeleteOperatorButNotDomain() throws Exception {
666659
logger.info("Deleting operator to check that domain functionality is not effected");
667660
operator.destroy();
668661
operator = null;
669-
Thread.sleep(60 * 1000);
670662
domain.testWlsLivenessProbe();
671663
testCompletedSuccessfully = true;
672664
} finally {
@@ -682,6 +674,39 @@ public void testDeleteOperatorButNotDomain() throws Exception {
682674
logger.info("SUCCESS - " + testMethodName);
683675
}
684676

677+
private void verifyOperatorDomainManagement(
678+
Operator operator, Domain domain, boolean isAccessible) throws Exception {
679+
for (int i = 0; i < maxIterations; i++) {
680+
681+
try {
682+
operator.verifyDomainExists(domain.getDomainUid());
683+
if (!isAccessible) {
684+
throw new RuntimeException("FAILURE: Operator still able to manage old namespace ");
685+
} else {
686+
break;
687+
}
688+
} catch (Exception ex) {
689+
if (!isAccessible) {
690+
if (!ex.getMessage()
691+
.contains(
692+
"Response {\"status\":404,\"detail\":\"/operator/latest/domains/test" + number)) {
693+
694+
} else {
695+
break;
696+
}
697+
}
698+
}
699+
if (i == maxIterations - 1) {
700+
String errorMsg = "FAILURE: Operator can't access the domain " + domain.getDomainUid();
701+
if (!isAccessible)
702+
errorMsg = "FAILURE: Operator still can access the domain " + domain.getDomainUid();
703+
throw new RuntimeException(errorMsg);
704+
}
705+
logger.info("iteration " + i + " of " + maxIterations);
706+
Thread.sleep(waitTime * 1000);
707+
}
708+
}
709+
685710
private Domain createVerifyDomain(int number, Operator operator) throws Exception {
686711
logger.info("create domain with UID : test" + number);
687712
Domain domain = TestUtils.createDomain(TestUtils.createDomainMap(number));
@@ -693,7 +718,7 @@ private Domain createVerifyDomain(int number, Operator operator) throws Exceptio
693718
return domain;
694719
}
695720

696-
private void upgradeVerifyOperatorDomainNamespaces(
721+
private void upgradeOperatorDomainNamespaces(
697722
Operator operator, ArrayList<String> targetNamespaces) throws Exception {
698723
logger.info("update operator with new target domain");
699724
String upgradeSet =
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<application xmlns="http://java.sun.com/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
5+
version="6">
6+
7+
</application>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
5+
version="3.1">
6+
</web-app>

0 commit comments

Comments
 (0)