Building and Testing

Submariner strives to be an open, welcoming community. Substantial tooling is provided to ease the contribution experience.

Standard Development Environment

Submariner provides a standard, shared environment for both development and CI that is maintained in the Shipyard project.

Learn more about working with Shipyard here.

Building and Testing

Submariner provides a set of Make targets for building and testing in the standard development environment.

Linting

To run all linting:

make lint

There are also Make targets for each type of linting:

make gitlint golangci-lint markdownlint yamllint

See the linter configuration files at the root of each repository for details about which checks are enabled.

Note that a few linters only run in CI via GitHub Actions and are not available in the standard development environment.

Unit Tests

To run Go unit tests:

make unit

Building

To build the Go binaries provided by a repository:

make build

To package those Go binaries into container images:

make images

Note that Submariner will automatically rebuild binaries and images when they have been modified and are required by tests.

To prune all Submariner-provided images, ensuring they will be rebuilt or pulled the next time they’re required:

make prune-images

If you’re using kind to test your changes, you can rebuild the images and reload them using a single command:

make reload-images

The command can restart the pods in order for the new images to take effect. To restart all pods:

make reload-images restart=all

To restart a specific pod, use the image name without the submariner- prefix, e.g.

make reload-images restart=gateway

End-to-End Tests

To run functional end-to-end tests with a full multi-cluster deployment:

make e2e

Different types of deployments can be configured with using flags:

make e2e using=helm,globalnet

The cable driver used to connect clusters can also be selected with using flags:

make e2e using=vxlan

In order to deploy clusters with OVN Kubernetes, the following command can be used:

make e2e using=ovn

See Shipyard’s Makefile.inc for the currently-supported using flags.

Additional Ginkgo flags can be passed using the TEST_ARGS flag.

For example, a subset of tests can be selected with Ginkgo’s focus flags:

make e2e TEST_ARGS='--ginkgo.focus=dataplane'

Alternatively, it’s possible to skip test(s) using Ginkgo’s skip flag:

make e2e TEST_ARGS='--ginkgo.skip=dataplane'

To create a multi-cluster deployment and install Submariner but not run tests:

make deploy

To create a multi-cluster deployment without Submariner:

make clusters

To clean up a multi-cluster deployment from one of the previous commands:

make clean-clusters

Shell Session in Development Environment

To jump into a shell in Submariner’s standard development environment:

make shell