tests

module
v0.0.0-...-cdc9d11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2022 License: Apache-2.0

README

Tests for YTT Cluster templates

This directory is a standalone toolkit for validating the cluster templates that are generated by tanzu-framework.

Validating these YTT templates generally involves:

  • using clustergen to compare a broad range of parametric variations for regressions in the expected behaviour after configuration changes that isn't explicitly tested.

  • using the newer, unit test module, which specifically can test your cluster's generation with YTT inputs and bespoke configurations in a unified way.

Clustergen tests

These tests run automatically for you in CI, changing many different types of parameters, storing resulting cluster templates, and then comparing how your new framework PR modifies cluster Yaml compared with the previous commit. These generally can give you hints at unintended changes you made, for more details, look in the clustergen directory.

Unit tests

The unit tests in this repository can be run like so:

cd pkg/v1/providers/tests/
go test -timeout 30s -run ^TestUnit$ github.com/vmware-tanzu/tanzu-framework/pkg/v1/providers/tests/unit/matchers

You can write an end to end unit test by:

  • Importing YTT values required for your cluster overlay.

  • Invoking the various YTT files required to make a cluster, simulating the normal behaviour of tanzu cli.

Input tkr and tkg boms

There are TKR and TKG bom files that are inluded in this directory for isolated testing purposes. They may need periodic updates, in a manner similar to that of the config_variable_association.star files in other parts of this repository.

Examples
  • For a "full cluster template" test, see the windows_test.go, which generates a full windows cluster from YTT and then verifies the top level topology of CAPI components.
  • For a more targeted test example of how a specific YTT module is behaving, see the ip_family tests, which verify the behaviour of YTT transformations that occur for various networking related functionality.

Directories

Path Synopsis
unit
matchers
Package matchers provides custom gomega matchers for tests.
Package matchers provides custom gomega matchers for tests.
ytt
Package ytt provides library for calling out to ytt the binary.
Package ytt provides library for calling out to ytt the binary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL