Skip to content

Commit 8dd15f6

Browse files
authored
Merge pull request #1099 from oracle/pmackin-OWLS-74223
OWLS-74223 : Missing DomainName test fails
2 parents d0d6252 + 726fef4 commit 8dd15f6

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,41 @@ public void testCreateChartWithInvalidAttributesNegativeInstall() throws Excepti
536536
}
537537

538538
/**
539-
* Helm will install the operator with empty target domains namespaces
539+
* Helm will install the operator with no override for domainNamespaces, resulting in the use of
540+
* "default" as the target namespace. NOTE: This test must not override domainNamespaces with an
541+
* empty set or the operator will fail when it performs security checks because the RoleBinding
542+
* for the weblogic-operator-rolebinding-namespace will be missing. Rather, just remove the
543+
* domainNamespaces override completely so that we pick up the Operator defaults specified in the
544+
* Operator helm chart values.yaml.
545+
*
546+
* @throws Exception
547+
*/
548+
@Test
549+
public void testCreateWithMissingTargetDomainInstall() throws Exception {
550+
Assume.assumeFalse(QUICKTEST);
551+
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
552+
logTestBegin(testMethodName);
553+
Operator operator = null;
554+
try {
555+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
556+
operatorMap.remove("domainNamespaces");
557+
operator = new Operator(operatorMap, RESTCertType.SELF_SIGNED);
558+
operator.callHelmInstall();
559+
operator.verifyOperatorReady();
560+
561+
} finally {
562+
number++;
563+
if (operator != null) {
564+
operator.destroy();
565+
}
566+
}
567+
logger.info("SUCCESS - " + testMethodName);
568+
}
569+
570+
/**
571+
* Helm will install the operator with empty string as target domains namespaces. This is
572+
* equivalent to what the QuickStart guide does when it installs the operator with ' --set
573+
* "domainNamespaces={}" '
540574
*
541575
* @throws Exception
542576
*/
@@ -549,6 +583,7 @@ public void testCreateWithEmptyTargetDomainInstall() throws Exception {
549583
try {
550584
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
551585
ArrayList<String> targetDomainsNS = new ArrayList<String>();
586+
targetDomainsNS.add("");
552587
operatorMap.replace("domainNamespaces", targetDomainsNS);
553588
operator = new Operator(operatorMap, RESTCertType.SELF_SIGNED);
554589
operator.callHelmInstall();

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Operator.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,14 @@ private void initialize(
483483
// create domain namespaces
484484

485485
ArrayList<String> domainNamespaces = (ArrayList<String>) operatorMap.get("domainNamespaces");
486-
for (int i = 0; i < domainNamespaces.size(); i++) {
487-
String domainNS = domainNamespaces.get(i);
488-
logger.info("domainNamespace " + domainNS);
489-
if (!domainNS.equals("default")) {
490-
logger.info("Creating domain namespace " + domainNS);
491-
ExecCommand.exec("kubectl create namespace " + domainNS);
486+
if (domainNamespaces != null) {
487+
for (int i = 0; i < domainNamespaces.size(); i++) {
488+
String domainNS = domainNamespaces.get(i);
489+
logger.info("domainNamespace " + domainNS);
490+
if (!domainNS.equals("default")) {
491+
logger.info("Creating domain namespace " + domainNS);
492+
ExecCommand.exec("kubectl create namespace " + domainNS);
493+
}
492494
}
493495
}
494496
}

0 commit comments

Comments
 (0)