xuyangzhong commented on code in PR #24728:
URL: https://github.com/apache/flink/pull/24728#discussion_r1583029959
##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java:
##########
@@ -511,6 +511,57 @@ void testShowJobsOperation(@InjectClusterClient
RestClusterClient<?> restCluster
.isBetween(timeOpStart, timeOpSucceed);
}
+ @Test
+ void testDescribeJobOperation(@InjectClusterClient RestClusterClient<?>
restClusterClient)
+ throws Exception {
+ SessionHandle sessionHandle =
service.openSession(defaultSessionEnvironment);
+ Configuration configuration = new
Configuration(MINI_CLUSTER.getClientConfiguration());
+
+ String pipelineName = "test-describe-job";
+ configuration.set(PipelineOptions.NAME, pipelineName);
+
+ // running jobs
+ String sourceDdl = "CREATE TABLE source (a STRING) WITH
('connector'='datagen');";
+ String sinkDdl = "CREATE TABLE sink (a STRING) WITH
('connector'='blackhole');";
+ String insertSql = "INSERT INTO sink SELECT * FROM source;";
+
+ service.executeStatement(sessionHandle, sourceDdl, -1, configuration);
+ service.executeStatement(sessionHandle, sinkDdl, -1, configuration);
+
+ long timeOpStart = System.currentTimeMillis();
+ OperationHandle insertsOperationHandle =
+ service.executeStatement(sessionHandle, insertSql, -1,
configuration);
+ String jobId =
+ fetchAllResults(sessionHandle, insertsOperationHandle)
+ .get(0)
+ .getString(0)
+ .toString();
+
+ TestUtils.waitUntilAllTasksAreRunning(restClusterClient,
JobID.fromHexString(jobId));
+ long timeOpSucceed = System.currentTimeMillis();
+
+ OperationHandle describeJobOperationHandle =
+ service.executeStatement(
+ sessionHandle,
+ String.format("DESCRIBE JOB '%s'", jobId),
+ -1,
+ configuration);
+
+ List<RowData> result = fetchAllResults(sessionHandle,
describeJobOperationHandle);
+ RowData jobRow =
+ result.stream()
+ .filter(row ->
jobId.equals(row.getString(0).toString()))
+ .findFirst()
+ .orElseThrow(
+ () ->
+ new IllegalStateException(
+ "Test job " + jobId + " not
found."));
+ assertThat(jobRow.getString(1)).hasToString(pipelineName);
+ assertThat(jobRow.getString(2)).hasToString("RUNNING");
Review Comment:
Yes, it's always RUNNING, because `ExecutionOptions.RUNTIME_MODE` is
streaming default.
--
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]