Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@

import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import static oracle.weblogic.kubernetes.TestConstants.OPERATOR_RELEASE_NAME;
import static oracle.weblogic.kubernetes.actions.TestActions.getOperatorPodName;
import static oracle.weblogic.kubernetes.assertions.TestAssertions.isPodRestarted;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
import static oracle.weblogic.kubernetes.utils.LoggingUtil.checkPodLogContainsString;
import static oracle.weblogic.kubernetes.utils.OKDUtils.createRouteForOKD;
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchServerStartPolicy;
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDeleted;
Expand Down Expand Up @@ -491,22 +488,6 @@ void testRestartNonExistingComponent() {
assertTrue(verifyExecuteResult(result, regex),"The script shouldn't start a domain that doesn't exist");
}

/**
* Verify Operator infrastructure log warning message, when the sample script
* tries to start a server that exceeds the max cluster size.
*/
@Order(7)
@Test
@DisplayName("verify the operator logs warning message when starting a server that exceeds max cluster size")
void testOperatorLogWarningMsg() {
String operatorPodName =
assertDoesNotThrow(() -> getOperatorPodName(OPERATOR_RELEASE_NAME, opNamespace));
logger.info("operator pod name: {0}", operatorPodName);
checkPodLogContainsString(opNamespace, operatorPodName, "WARNING");
checkPodLogContainsString(opNamespace, operatorPodName,
"management/weblogic/latest/serverRuntime/search failed with exception java.net.ConnectException");
}

/**
* Once the admin server is stopped, operator can not start a new managed
* server from scratch if it has never been started earlier with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.CONFIG_CLUSTER;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.DYNAMIC_CLUSTER;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.ROLLING_CLUSTER_SCRIPT;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.SCALE_CLUSTER_SCRIPT;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.SERVER_LIFECYCLE;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.START_CLUSTER_SCRIPT;
import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.START_SERVER_SCRIPT;
Expand Down Expand Up @@ -556,4 +557,25 @@ void testDynamicClusterScale() {
scalingClusters(domainUid, domainNamespace,DYNAMIC_CLUSTER, dynamicServerPodName,
replicaCount, regex, false, samplePath);
}

/**
* Verify the sample script reports proper error when a cluster is scaled beyond max cluster size.
*/
@Order(10)
@Test
@DisplayName("verify the sample script fails when a cluster is scaled beyond max cluster size")
void testScaleBeyondMaxClusterSize() {
int newReplicaCount = 7;
String expectedResult = "Replicas value is not in the allowed range";
// use scaleCluster.sh to scale a given cluster
logger.info("Scale cluster {0} using the script scaleCluster.sh", DYNAMIC_CLUSTER);
String result = assertDoesNotThrow(() ->
executeLifecycleScript(domainUid, domainNamespace, samplePath,
SCALE_CLUSTER_SCRIPT, CLUSTER_LIFECYCLE, DYNAMIC_CLUSTER, " -r " + newReplicaCount, false),
String.format("Failed to run %s", SCALE_CLUSTER_SCRIPT));
assertTrue(result.contains(expectedResult), "Expected result " + expectedResult + "not returned");
// verify the replica did not change
assertDoesNotThrow(() -> assertTrue(checkClusterReplicaCountMatches(DYNAMIC_CLUSTER,
domainUid, domainNamespace, replicaCount)));
}
}