Skip to content

Commit

Permalink
[FLINK-17383] Do not use CollectionEnvironment in flink-planner tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidwys committed Jun 18, 2020
1 parent ec9f68d commit eb57c49
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class TableEnvironmentITCase(
assertEquals("", Source.fromFile(resultFile).mkString)

env.execute("job")
val expected2 = "8,24.953750000000003\n"
val expected2 = "8,24.95375\n"
val actual = Source.fromFile(resultFile).mkString
assertEquals(expected2, actual)
// does not trigger the table program execution again
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import org.apache.flink.table.utils.MemoryTableSourceSinkUtil
import org.apache.flink.table.utils.MemoryTableSourceSinkUtil.UnsafeMemoryOutputFormatTableSink
import org.apache.flink.test.util.TestBaseUtils

import org.junit.Test
import org.junit.rules.TemporaryFolder
import org.junit.{Rule, Test}
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

Expand All @@ -44,11 +45,15 @@ class TableSinkITCase(
configMode: TableConfigMode)
extends TableProgramsCollectionTestBase(configMode) {

val _tempFolder = new TemporaryFolder

@Rule
def tempFolder: TemporaryFolder = _tempFolder

@Test
def testBatchTableSink(): Unit = {

val tmpFile = File.createTempFile("flink-table-sink-test", ".tmp")
tmpFile.deleteOnExit()
val tmpFile = tempFolder.newFolder("flink-table-sink-test")
val path = tmpFile.toURI.toString

val env = ExecutionEnvironment.getExecutionEnvironment
Expand All @@ -63,7 +68,7 @@ class TableSinkITCase(
val input = CollectionDataSets.get3TupleDataSet(env)
.map(x => x).setParallelism(4) // increase DOP to 4

val results = input.toTable(tEnv, 'a, 'b, 'c)
input.toTable(tEnv, 'a, 'b, 'c)
.where('a < 5 || 'a > 17)
.select('c, 'b)
.insertInto("testSink")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ import scala.collection.JavaConversions._
* This test base provides lightweight integration tests for batch programs. However, it does
* not test everything (e.g. combiners). Runtime operator tests should
* use [[TableProgramsClusterTestBase]].
*
* It does not use the COLLECTION execution mode any longer as the CollectionEnvironment is
* deprecated. Because of the plans of removing the legacy planner we do not refactor the class
* too much.
*/
class TableProgramsCollectionTestBase(
tableConfigMode: TableConfigMode)
extends TableProgramsTestBase(TestExecutionMode.COLLECTION, tableConfigMode) {
extends TableProgramsTestBase(TestExecutionMode.CLUSTER, tableConfigMode) {
}

object TableProgramsCollectionTestBase {
Expand Down

0 comments on commit eb57c49

Please sign in to comment.