|
36 | 36 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.CONFIG_CLUSTER; |
37 | 37 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.DYNAMIC_CLUSTER; |
38 | 38 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.ROLLING_CLUSTER_SCRIPT; |
| 39 | +import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.SCALE_CLUSTER_SCRIPT; |
39 | 40 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.SERVER_LIFECYCLE; |
40 | 41 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.START_CLUSTER_SCRIPT; |
41 | 42 | import static oracle.weblogic.kubernetes.utils.ServerStartPolicyUtils.START_SERVER_SCRIPT; |
@@ -556,4 +557,25 @@ void testDynamicClusterScale() { |
556 | 557 | scalingClusters(domainUid, domainNamespace,DYNAMIC_CLUSTER, dynamicServerPodName, |
557 | 558 | replicaCount, regex, false, samplePath); |
558 | 559 | } |
| 560 | + |
| 561 | + /** |
| 562 | + * Verify the sample script reports proper error when a cluster is scaled beyond max cluster size. |
| 563 | + */ |
| 564 | + @Order(10) |
| 565 | + @Test |
| 566 | + @DisplayName("verify the sample script fails when a cluster is scaled beyond max cluster size") |
| 567 | + void testScaleBeyondMaxClusterSize() { |
| 568 | + int newReplicaCount = 7; |
| 569 | + String expectedResult = "Replicas value is not in the allowed range"; |
| 570 | + // use scaleCluster.sh to scale a given cluster |
| 571 | + logger.info("Scale cluster {0} using the script scaleCluster.sh", DYNAMIC_CLUSTER); |
| 572 | + String result = assertDoesNotThrow(() -> |
| 573 | + executeLifecycleScript(domainUid, domainNamespace, samplePath, |
| 574 | + SCALE_CLUSTER_SCRIPT, CLUSTER_LIFECYCLE, DYNAMIC_CLUSTER, " -r " + newReplicaCount, false), |
| 575 | + String.format("Failed to run %s", SCALE_CLUSTER_SCRIPT)); |
| 576 | + assertTrue(result.contains(expectedResult), "Expected result " + expectedResult + "not returned"); |
| 577 | + // verify the replica did not change |
| 578 | + assertDoesNotThrow(() -> assertTrue(checkClusterReplicaCountMatches(DYNAMIC_CLUSTER, |
| 579 | + domainUid, domainNamespace, replicaCount))); |
| 580 | + } |
559 | 581 | } |
0 commit comments