Skip to content

Working with Rancher

Ugur edited this page Feb 27, 2024 · 6 revisions

Shepherd can be used in validation and integration tests. This section covers Shepherd's usages in the release tests and integration tests on Rancher. Shepherd can be implemented in any Kubernetes project, however its main focus and examples are going to be on Rancher.

Before starting to read this section, please read below:

Infrastructure and Pipelines

Infrastructure and Pipelines are strongly related to the Shepherd as it is a testing framework.

Integration

Rancher uses Drone pipeline and Dapper containers. Existing tests happen against v2prov downstream clusters or Rancher local clusters. As a Shepherd de facto standard, it needs a configuration file. The configuration setup happens before the v2prov downstream cluster is up.

After the setup is completed, the suites inside this directory run sequentially. You can learn more about this step, here.

More information can be found integration tests documentation.

Validation

Validation tests are run both on-demand and on a recurring basis through this pipeline, provided their tags or flags are set appropriately. To run validation tests on demand, Jenkins pipelines are used and you can check out some pipeline examples here.

Validation tests can run against actual environments, docker-like environments - such as integration testing. Creating or setting an environment as desired is achieved by using the Corral. Corral is the main infrastructure tool for these validation pipelines. And different environments are part of the Corral Packages repository.

Integration Tests

Integration Tests can be found in v2/integration. To run these tests, a configuration file is required. Learn more about configuration files, here.

Integration tests usually run in a CI environment with the given rules. These test can run run on demand like the validation tests as well.

Unlike the validation tests, the only necessary setup is this configuration file. You can learn more about the difference between integration and validation tests.

Validation Tests

Before starting to read this section, you can learn more about infrastructure and pipeline tools that are used for the validation tests here.

Validation Tests are divided into two different subcategories:

  • Standalone Validation Tests
  • Release Validation Pipelines

Standalone Validation Tests

As mentioned previously, the validation test examples are given with Rancher tests. These Rancher validation tests can be found in the v2/validation directory in the Rancher repository. These tests run on demand and require external services —for example, a Rancher instance with a downstream cluster with a cloud provider.

To run these tests, a configuration file is required. Learn more about configuration files, here.

After these two necessary steps; Configuration and the External Service or Setup, you can run these suites or test cases within a suite as normal Go tests.

Release Validation Pipelines

Release Validation Pipelines are pipelines that include multiple stages to set the environment, do some necessary preparation steps before running the test runs, and run standalone tests in a designed flow.

You can read more about Pipeline Packages and Release Validation Pipelines, here.