Documentation ¶
Index ¶
- Variables
- func Execute(t *testing.T, cmd *exec.Cmd) []byte
- func FailOutput(t *testing.T, actual, expected any)
- func Flags()
- func HelmCommand(t *testing.T, chartsDir string, args ...string) []byte
- func HelmTest(t *testing.T, chartName, testName, namespace, valuesFileName, chartsDir string)
- func KubectlCreateNamespace(t *testing.T, namespace string)
- func KubectlDeleteNamespace(t *testing.T, namespace string)
- func KubectlFileOp(t *testing.T, operation Operation, namespace, fileName string)
- func KubectlGetOp(t *testing.T, kind, namespace, name string) []byte
- func MarshaledEqual(t *testing.T, a, b any)
- func NewTestNamespace(testName string) string
- func NormalizeConnectivity(t *testing.T, objectData []byte) []byte
- func NormalizeDeployment(t *testing.T, objectData []byte) []byte
- func NormalizeExposeService(t *testing.T, objectData []byte) []byte
- func NormalizeFabricService(t *testing.T, objectData []byte) []byte
- func NormalizeKubernetesObject(t *testing.T, object []byte) []byte
- func NormalizeTopology(t *testing.T, objectData []byte) []byte
- func ReadAllRenderedTemplates(t *testing.T, rootRenderDir string) map[string][]byte
- func ReadTestFile(t *testing.T, f string) []byte
- func ReadTestFixtureFile(t *testing.T, f string) []byte
- func WriteTestFile(t *testing.T, f string, b []byte)
- func WriteTestFixtureFile(t *testing.T, f string, b []byte)
- func WriteTestFixtureJSON(t *testing.T, f string, o interface{})
- func WriteTestJSON(t *testing.T, f string, o interface{})
- func YQCommand(t *testing.T, content []byte, yqPattern string) []byte
- type Operation
Constants ¶
This section is empty.
Variables ¶
var OnlyDiff = flag.Bool( "onlyDiff", false, "only show diff where possible -- skip printing out actual/expected", )
OnlyDiff is a bool flag that indicates if the test fail output should only include the diff where possible.
var SkipCleanup = flag.Bool( "skipCleanup", false, "skip cleaning up namespaces", )
SkipCleanup is a bool flag that indicates if the e2e tests should skip clean up or not, by default this is *false* (as in we clean things up).
var Update = flag.Bool("update", false, "update the golden files") //nolint: gochecknoglobals
Update is the flag indicating if golden files should be updated when running tests.
Functions ¶
func FailOutput ¶
FailOutput is a simple func to nicely print actual vs expected output when a test fails.
func HelmCommand ¶ added in v0.0.17
HelmCommand executes helm with the given arguments.
func HelmTest ¶ added in v0.0.17
HelmTest executes a test against a helm chart -- this is a very simple/dumb test meant only to ensure that we don't accidentally screw up charts. We do this by storing the "golden" output of a rendered chart (and subcharts if applicable) with a given values file.
func KubectlCreateNamespace ¶ added in v0.0.17
KubectlCreateNamespace execs a kubectl create namespace.
func KubectlDeleteNamespace ¶ added in v0.0.17
KubectlDeleteNamespace execs a kubectl delete namespace.
func KubectlFileOp ¶ added in v0.0.17
KubectlFileOp execs a kubectl operation on a file (i.e. apply/delete).
func KubectlGetOp ¶ added in v0.0.17
KubectlGetOp runs get on the given object, returning the yaml output.
func MarshaledEqual ¶ added in v0.0.17
MarshaledEqual marshals (json marshal) a and b and bytes.Equal compares them. If they are not equal FailOutput is called.
func NewTestNamespace ¶ added in v0.0.17
NewTestNamespace generates a namespace for a test.
func NormalizeConnectivity ¶ added in v0.0.30
NormalizeConnectivity normalizes a connectivity cr between ci and local or other folks machines/clusters -- so we can compare results more easily. For now this is just replacing the namespace in the destinations since those will be random(ish) per test run.
func NormalizeDeployment ¶ added in v0.0.30
NormalizeDeployment normalizes a deployment by removing fields that may change between ci and local or other folks machines/clusters (like image/registry)-- so we can compare results more easily.
func NormalizeExposeService ¶ added in v0.0.19
NormalizeExposeService normalizes a service cr by removing fields that may change between ci and local or other folks machines/clusters -- so we can compare results more easily.
func NormalizeFabricService ¶ added in v0.0.30
NormalizeFabricService normalizes a (fabric) service cr by removing fields that may change between ci and local or other folks machines/clusters -- so we can compare results more easily.
func NormalizeKubernetesObject ¶ added in v0.0.17
NormalizeKubernetesObject does some janky regex replace to remove controller generated fields we don't want to compare.
func NormalizeTopology ¶ added in v0.0.19
NormalizeTopology normalizes a clabernetes topology cr by removing fields that may change between ci and local or other folks machines/clusters -- so we can compare results more easily.
func ReadAllRenderedTemplates ¶ added in v0.0.17
ReadAllRenderedTemplates loads all rendered template content into a map -- sub-charts are loaded with a "_subchart-<CHARTNAME>-" prefix.
func ReadTestFile ¶ added in v0.0.16
ReadTestFile is a helper to read a (usually) golden file in the context of a test (hence testing.T).
func ReadTestFixtureFile ¶ added in v0.0.16
ReadTestFixtureFile is a helper to read a test fixture file.
func WriteTestFile ¶ added in v0.0.16
WriteTestFile is a helper to write json to the specified file in the context of a test.
func WriteTestFixtureFile ¶ added in v0.0.16
WriteTestFixtureFile is a helper to write out a test fixture file.
func WriteTestFixtureJSON ¶ added in v0.0.16
WriteTestFixtureJSON is a helper to write JSON into a test fixture file.
func WriteTestJSON ¶ added in v0.0.16
WriteTestJSON is a helper to write JSON to the specified file in the context of a test.