Skip to content

Commit 726fef4

Browse files
committed
OWLS-74223 : ITUsabilityOperatorHelmChart.testCreateWithMissingTargetDomainInstall test fails.
The problem was that the override file had domainNamespaces:[], which is an empty set and causes the .domain-namespaces.tpl to skip the generation of the namespace role binding. This, in turn, caused the operator HealthCheckHelper to take much longer and timeout. Fix the test so that it generates the helm override values.yaml file without a domainNamespace at all so that he operator default value is used. Also, add a new test which passes an empty string as the domainNamespaces entry, this simulates the QuickStart install instructions where --set "domainNamespaces={}" is used.
1 parent 0cca90a commit 726fef4

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)