layout: global title: Spark on Kubernetes Integration Tests

This Repository is Frozen: CI is Moved to Apache Spark upstream.

Now that Apache Spark has upstreamed integration testing for the Kubernetes back-end, all future CI related development will be submitted to Apache Spark upstream.

Running the Kubernetes Integration Tests

Note that the integration test framework is currently being heavily revised and is subject to change. Note that currently the integration tests only run with Java 8.

The simplest way to run the integration tests is to install and run Minikube, then run the following:

dev/dev-run-integration-tests.sh

The minimum tested version of Minikube is 0.23.0. The kube-dns addon must be enabled. Minikube should run with a minimum of 3 CPUs and 4G of memory:

minikube start --cpus 3 --memory 4096

You can download Minikube here.

Integration test customization

Configuration of the integration test runtime is done through passing different arguments to the test script. The main useful options are outlined below.

Use a non-local cluster

To use your own cluster running in the cloud, set the following:

Therefore the command looks like this:

dev/dev-run-integration-tests.sh \
  --deploy-mode cloud \
  --spark-master https://example.com:8443/apiserver \
  --image-repo docker.example.com/spark-images

Re-using Docker Images

By default, the test framework will build new Docker images on every test execution. A unique image tag is generated, and it is written to file at target/imageTag.txt. To reuse the images built in a previous run, or to use a Docker image tag that you have built by other means already, pass the tag to the test script:

dev/dev-run-integration-tests.sh --image-tag <tag>

where if you still want to use images that were built before by the test framework:

dev/dev-run-integration-tests.sh --image-tag $(cat target/imageTag.txt)

Customizing the Spark Source Code to Test

By default, the test framework will test the master branch of Spark from here. You can specify the following options to test against different source versions of Spark:

An example:

dev/dev-run-integration-tests.sh \
  --spark-repo https://github.com/apache-spark-on-k8s/spark \
  --spark-branch new-feature

Additionally, you can use a pre-built Spark distribution. In this case, the repository is not cloned at all, and no source code has to be compiled.

When the tests are cloning a repository and building it, the Spark distribution is placed in target/spark/spark-<VERSION>.tgz. Reuse this tarball to save a significant amount of time if you are iterating on the development of these integration tests.

Customizing the Namespace and Service Account