You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flink/flink-end-to-end-tests
pvary c3a07f98e5
[FLINK-25857] Add committer metrics to track the status of committables
Temporarily disables failing python connector tests which should be moved to external repositories.

---------

Co-authored-by: Peter Vary <peter_vary4@apple.com>
1 year ago
..
flink-batch-sql-test Update version to 1.19-SNAPSHOT 1 year ago
flink-cli-test [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update (#23344) 1 year ago
flink-confluent-schema-registry Update version to 1.19-SNAPSHOT 1 year ago
flink-dataset-allround-test Update version to 1.19-SNAPSHOT 1 year ago
flink-dataset-fine-grained-recovery-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-datastream-allround-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-distributed-cache-via-blob-test Update version to 1.19-SNAPSHOT 1 year ago
flink-end-to-end-tests-common Update version to 1.19-SNAPSHOT 1 year ago
flink-end-to-end-tests-hive [FLINK-32731][e2e] Fix NameNode uses port 9870 in hadoop3 1 year ago
flink-end-to-end-tests-jdbc-driver Update version to 1.19-SNAPSHOT 1 year ago
flink-end-to-end-tests-restclient Update version to 1.19-SNAPSHOT 1 year ago
flink-end-to-end-tests-scala Update version to 1.19-SNAPSHOT 1 year ago
flink-end-to-end-tests-sql Update version to 1.19-SNAPSHOT 1 year ago
flink-failure-enricher-test [FLINK-31895][runtime] Add End-to-end integration tests for failure labels 1 year ago
flink-file-sink-test [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update (#23344) 1 year ago
flink-heavy-deployment-stress-test [FLINK-32620][sink] Migrate DiscardingSink to sinkv2. 1 year ago
flink-high-parallelism-iterations-test Update version to 1.19-SNAPSHOT 1 year ago
flink-local-recovery-and-allocation-test [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update (#23344) 1 year ago
flink-metrics-availability-test Update version to 1.19-SNAPSHOT 1 year ago
flink-metrics-reporter-prometheus-test Update version to 1.19-SNAPSHOT 1 year ago
flink-netty-shuffle-memory-control-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-parent-child-classloading-test-lib-package Update version to 1.19-SNAPSHOT 1 year ago
flink-parent-child-classloading-test-program Update version to 1.19-SNAPSHOT 1 year ago
flink-plugins-test Update version to 1.19-SNAPSHOT 1 year ago
flink-python-test Update version to 1.19-SNAPSHOT 1 year ago
flink-queryable-state-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-quickstart-test Update version to 1.19-SNAPSHOT 1 year ago
flink-quickstart-test-dummy-dependency Update version to 1.19-SNAPSHOT 1 year ago
flink-rocksdb-state-memory-control-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-sql-client-test Update version to 1.19-SNAPSHOT 1 year ago
flink-sql-gateway-test [FLINK-32731][e2e] Add retry mechanism when fails to start the namenode (#23267) 1 year ago
flink-state-evolution-test [FLINK-32978][flink-core] Migrate the usage of RichFunction#open(Configuration parameters) to RichFunction#open(OpenContext openContext) 1 year ago
flink-stream-sql-test [FLINK-30217] Replace ListState#clear along with following #add/addAll with a ListState#update (#23344) 1 year ago
flink-stream-state-ttl-test Update version to 1.19-SNAPSHOT 1 year ago
flink-stream-stateful-job-upgrade-test Update version to 1.19-SNAPSHOT 1 year ago
flink-tpcds-test Update version to 1.19-SNAPSHOT 1 year ago
flink-tpch-test Update version to 1.19-SNAPSHOT 1 year ago
test-scripts [FLINK-32107][test] Adds retry to artifact downloads (#23528) 1 year ago
.gitignore [FLINK-30024][tests] Build local test KDC docker image 2 years ago
README.md [FLINK-25159][tests] Streamline E2E surefire setup 3 years ago
pom.xml [FLINK-31895][runtime] Add End-to-end integration tests for failure labels 1 year ago
run-nightly-tests.sh [FLINK-25857] Add committer metrics to track the status of committables 1 year ago
run-single-test.sh [FLINK-23965][e2e] Store logs under FLINK_DIR/log 3 years ago

README.md

Flink End-to-End Tests

This module contains tests that verify end-to-end behaviour of Flink.

The tests defined in run-nightly-tests.sh are run by the CI system on every pull request and push to master.

Running Tests

You can run all tests by executing

$ FLINK_DIR=<flink dir> flink-end-to-end-tests/run-nightly-tests.sh

where <flink dir> is a Flink distribution directory.

You can also run tests individually via

$ FLINK_DIR=<flink dir> flink-end-to-end-tests/run-single-test.sh your_test.sh arg1 arg2

NOTICE: Please DON'T run the scripts with explicit command like sh run-nightly-tests.sh since #!/usr/bin/env bash is specified as the header of the scripts to assure flexibility on different systems.

NOTICE: We do not recommend executing the nightly test script on production or personal desktop systems, as tests contained there might modify the environment (leftover processes, modification of system files, request for root permissions via sudo, ...).

Kubernetes test

Kubernetes test (test_kubernetes_embedded_job.sh) assumes a running minikube cluster.

Writing Tests

As of November 2020, Flink has two broad types of end-to-end tests: Bash-based end-to-end tests, located in the test-scripts/ directory and Java-based end-to-end tests, such as the PrometheusReporterEndToEndITCase. The community recommends writing new tests as Java tests, as we are planning to deprecate the bash-based tests in the long run.

Examples

Have a look at test_batch_wordcount.sh for a very basic test and test_streaming_kafka010.sh for a more involved example. Whenever possible, try to put new functionality in common.sh so that it can be reused by other tests.

Adding a test case

In order to add a new test case you need add it to test-scripts/run-nightly-tests.sh. Templates on how to add tests can be found in those respective files.

Note: If you want to parameterize your tests please do so by adding multiple test cases with parameters as arguments to the nightly / pre-commit test suites. This allows the test runner to do a cleanup in between each individual test and also to fail those tests individually.

Note: While developing a new test case make sure to enable bash's error handling in test-scripts/common.sh by uncommenting set -Eexuo pipefail and commenting the current default set call. Once your test is implemented properly, add set -Eeuo pipefail on the very top of your test script (before any common script).

Passing your test

A test is considered to have passed if it:

  • has exit code 0
  • there are no non-empty .out files (nothing was written to stdout / stderr by your Flink program)
  • there are no exceptions in the log files
  • there are no errors in the log files

Note: There is a whitelist for exceptions and errors that do not lead to failure, which can be found in the check_logs_for_errors and check_logs_for_exceptions in test-scripts/common.sh.

Please note that a previously supported pattern where you could assign a value the global variable PASS to have your tests fail is not supported anymore.

Cleanup

The test runner performs a cleanup after each test case, which includes:

  • Stopping the cluster
  • Killing all task and job managers
  • Reverting conf and lib dirs to default
  • Cleaning up log and temp directories

In some cases your test is required to do some additional cleanup, for example shutting down external systems like Kafka or Elasticsearch. In this case you can register a function that will be called on test exit like this:

function test_cleanup {
    # do your custom cleanup here
}

on_exit test_cleanup