Skip to content

Commit

Permalink
[FLINK-18247][table-planner-blink] Fix unstable test: TableITCase.tes…
Browse files Browse the repository at this point in the history
…tCollectWithClose

This closes #12595
  • Loading branch information
godfreyhe committed Jun 11, 2020
1 parent 0028e2e commit 0b0a6bc
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -28,7 +28,7 @@ import org.apache.flink.util.TestLogger

import org.apache.flink.shaded.guava18.com.google.common.collect.Lists

import org.junit.Assert.{assertEquals, assertTrue}
import org.junit.Assert.{assertEquals, assertNotEquals, assertTrue}
import org.junit.rules.{ExpectedException, TemporaryFolder}
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
Expand Down Expand Up @@ -119,7 +119,16 @@ class TableITCase(tableEnvName: String, isStreaming: Boolean) extends TestLogger
assertEquals(ResultKind.SUCCESS_WITH_CONTENT, tableResult.getResultKind)
val it = tableResult.collect()
it.close()
assertEquals(JobStatus.CANCELED, tableResult.getJobClient.get().getJobStatus().get())
val jobStatus = try {
Some(tableResult.getJobClient.get().getJobStatus.get())
} catch {
// ignore the exception,
// because the MiniCluster maybe already been shut down when getting job status
case _: Throwable => None
}
if (jobStatus.isDefined) {
assertNotEquals(JobStatus.RUNNING, jobStatus.get)
}
}

@Test
Expand Down

0 comments on commit 0b0a6bc

Please sign in to comment.