testhelpers

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareDir

func CompareDir(t *testing.T, expectDir, actualDir string)

CompareDir compares the contents of two directories only compare KRM YAML resources?

func CompareFile

func CompareFile(t *testing.T, expectDir, actualDir string, relPath string)

CompareFile compares a single file of the same relative path between "expectDir" and "actualDir"

func CompareGoldenFile

func CompareGoldenFile(t *testing.T, expectedPath string, got []byte)

CompareGoldenFile compares the "got" data with the data stored in a "expectedPath".

func CopyDir

func CopyDir(src, dest string) error

CopyDir copies an entire directory from "src" to "dest"

func CopyFile

func CopyFile(src, dest string) error

CopyFile copies a single file from "src" to "dest"

func IsValidYAMLOrKptfile

func IsValidYAMLOrKptfile(fname string) bool

func MustReadFile

func MustReadFile(t *testing.T, expectedPath string) []byte

MustReadFile reads the data from "expectedPath"

func RunGoldenTests

func RunGoldenTests(t *testing.T, basedir string, krmFunction kubeobject.ResourceListProcessor)

RunGoldenTests provides the test infra to run golden test. "basedir" should be the parent directory, under where the sub-directories contains test data. For example, the "testdata" is the basedir. It contains two cases "test1" and "test2"

└── testdata
    └── test1
        ├── _expected.yaml
        ├── _fnconfig.yaml
        └── resources.yaml
    └── test2
        ├── _expected.yaml
        ├── _fnconfig.yaml
        └── resources.yaml

- "krmFunction" should be your ResourceListProcessor implementation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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