|
24 | 24 | import org.junit.jupiter.api.Test;
|
25 | 25 | import org.testcontainers.containers.Container;
|
26 | 26 |
|
| 27 | +import lombok.extern.slf4j.Slf4j; |
| 28 | + |
27 | 29 | import java.io.IOException;
|
| 30 | +import java.util.concurrent.CompletableFuture; |
| 31 | +import java.util.concurrent.TimeUnit; |
28 | 32 |
|
29 | 33 | import static org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
|
| 34 | +import static org.testcontainers.shaded.org.awaitility.Awaitility.given; |
30 | 35 |
|
| 36 | +@Slf4j |
31 | 37 | public class JobClientJobProxyIT extends SeaTunnelEngineContainer {
|
32 | 38 |
|
33 | 39 | @Override
|
@@ -73,6 +79,44 @@ public void testNoDuplicatedReleaseSlot() throws IOException, InterruptedExcepti
|
73 | 79 | server.getLogs().contains("wrong target release operation with job"));
|
74 | 80 | }
|
75 | 81 |
|
| 82 | + @Test |
| 83 | + public void testNoExceptionLogWhenCancelJob() throws IOException, InterruptedException { |
| 84 | + String jobId = String.valueOf(System.currentTimeMillis()); |
| 85 | + CompletableFuture.runAsync( |
| 86 | + () -> { |
| 87 | + try { |
| 88 | + executeJob( |
| 89 | + "/stream_fakesource_to_inmemory_pending_row_in_queue.conf", jobId); |
| 90 | + } catch (Exception e) { |
| 91 | + log.error("Commit task exception :" + e.getMessage()); |
| 92 | + throw new RuntimeException(); |
| 93 | + } |
| 94 | + }); |
| 95 | + |
| 96 | + given().pollDelay(10, TimeUnit.SECONDS) |
| 97 | + .await() |
| 98 | + .pollDelay(5000L, TimeUnit.MILLISECONDS) |
| 99 | + .untilAsserted( |
| 100 | + () -> { |
| 101 | + Assertions.assertEquals("RUNNING", this.getJobStatus(jobId)); |
| 102 | + }); |
| 103 | + |
| 104 | + String logBeforeCancel = this.getServerLogs(); |
| 105 | + cancelJob(jobId); |
| 106 | + given().pollDelay(10, TimeUnit.SECONDS) |
| 107 | + .await() |
| 108 | + .pollDelay(5000L, TimeUnit.MILLISECONDS) |
| 109 | + .untilAsserted( |
| 110 | + () -> { |
| 111 | + Assertions.assertEquals("CANCELED", this.getJobStatus(jobId)); |
| 112 | + }); |
| 113 | + String logAfterCancel = this.getServerLogs().substring(logBeforeCancel.length()); |
| 114 | + // in TaskExecutionService.BlockingWorker::run catch Throwable |
| 115 | + Assertions.assertFalse(logAfterCancel.contains("Exception in"), logAfterCancel); |
| 116 | + Assertions.assertEquals( |
| 117 | + 4, StringUtils.countMatches(logAfterCancel, "Interrupted task"), logAfterCancel); |
| 118 | + } |
| 119 | + |
76 | 120 | @Test
|
77 | 121 | public void testMultiTableSinkFailedWithThrowable() throws IOException, InterruptedException {
|
78 | 122 | Container.ExecResult execResult =
|
|
0 commit comments