zhangshenghang commented on code in PR #7693:
URL: https://github.com/apache/seatunnel/pull/7693#discussion_r1793506515
##########
seatunnel-engine/seatunnel-engine-client/src/test/java/org/apache/seatunnel/engine/client/SeaTunnelEngineClusterRoleTest.java:
##########
@@ -173,6 +176,137 @@ public void canNotSubmitJobWhenHaveNoWorkerNode() {
}
}
+ @SneakyThrows
+ @Test
+ public void enterPendingWhenResourcesNotEnough() {
+ HazelcastInstanceImpl masterNode = null;
+ String testClusterName = "Test_enterPendingWhenResourcesNotEnough";
+ SeaTunnelClient seaTunnelClient = null;
+
+ SeaTunnelConfig seaTunnelConfig =
ConfigProvider.locateAndGetSeaTunnelConfig();
+ // set job pending
+ EngineConfig engineConfig = seaTunnelConfig.getEngineConfig();
+ engineConfig.setScheduleStrategy(ScheduleStrategy.WAIT);
+ engineConfig.getSlotServiceConfig().setDynamicSlot(false);
+ engineConfig.getSlotServiceConfig().setSlotNum(3);
+ seaTunnelConfig
+ .getHazelcastConfig()
+ .setClusterName(TestUtils.getClusterName(testClusterName));
+
+ // submit job
+ Common.setDeployMode(DeployMode.CLIENT);
+ String filePath = TestUtils.getResource("/client_test.conf");
+ JobConfig jobConfig = new JobConfig();
+ jobConfig.setName("Test_enterPendingWhenResourcesNotEnough");
+
+ try {
+ // master node must start first in ci
+ masterNode =
SeaTunnelServerStarter.createMasterHazelcastInstance(seaTunnelConfig);
+
+ HazelcastInstanceImpl finalMasterNode = masterNode;
+ Awaitility.await()
+ .atMost(10000, TimeUnit.MILLISECONDS)
+ .untilAsserted(
+ () ->
+ Assertions.assertEquals(
+ 1,
finalMasterNode.getCluster().getMembers().size()));
+
+ // new seatunnel client and submit job
+ seaTunnelClient = createSeaTunnelClient(testClusterName);
+ ClientJobExecutionEnvironment jobExecutionEnv =
+ seaTunnelClient.createExecutionContext(filePath,
jobConfig, seaTunnelConfig);
+ final ClientJobProxy clientJobProxy = jobExecutionEnv.execute();
+ Awaitility.await()
+ .atMost(10000, TimeUnit.MILLISECONDS)
+ .untilAsserted(
+ () ->
+ Assertions.assertEquals(
+ clientJobProxy.getJobStatus(),
JobStatus.PENDING));
+ // start two worker nodes
+
SeaTunnelServerStarter.createWorkerHazelcastInstance(seaTunnelConfig);
+
SeaTunnelServerStarter.createWorkerHazelcastInstance(seaTunnelConfig);
+
+ // There are already resources available, wait for job enter
running or complete
+ Awaitility.await()
+ .atMost(60000, TimeUnit.MILLISECONDS)
+ .untilAsserted(
+ () ->
+ Assertions.assertEquals(
+ JobStatus.FINISHED,
clientJobProxy.getJobStatus()));
+ System.out.println("1234:" + clientJobProxy.getJobStatus());
Review Comment:
already delete
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]