Interface TestEnvironment

All Superinterfaces:
TestResource
All Known Implementing Classes:
FlinkContainerTestEnvironment, MiniClusterTestEnvironment

@Experimental public interface TestEnvironment extends TestResource
Test environment for running Flink jobs.

The environment is bound with a Flink cluster, such as MiniCluster, Flink on container, or even a running session cluster.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Endpoint with address and port of the test environment.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
    Get an instance of StreamExecutionEnvironment for building and executing Flink jobs based on the provided configuration.
    Get a path in string for storing checkpoint and savepoint in the test environment.
    Get endpoint of the test environment for connecting via REST API.

    Methods inherited from interface org.apache.flink.connector.testframe.TestResource

    startUp, tearDown
  • Method Details

    • createExecutionEnvironment

      org.apache.flink.streaming.api.environment.StreamExecutionEnvironment createExecutionEnvironment(TestEnvironmentSettings envOptions)
      Get an instance of StreamExecutionEnvironment for building and executing Flink jobs based on the provided configuration.

      Note that this environment should be bound with the Flink cluster, because this will be the entrypoint to submit Flink jobs (via StreamExecutionEnvironment.execute()) in test cases.

      Parameters:
      envOptions - options for the environment to satisfy
    • getRestEndpoint

      TestEnvironment.Endpoint getRestEndpoint()
      Get endpoint of the test environment for connecting via REST API.
    • getCheckpointUri

      String getCheckpointUri()
      Get a path in string for storing checkpoint and savepoint in the test environment.

      Note that testing framework may have no access to this storage (e.g. Flink cluster is on some cloud service and testing framework is executed locally). In test cases for testing failover scenario, this path will be passed to cluster client directly for triggering checkpoint / savepoint in this path and recovering from checkpoint / savepoint stored under this path.