testhelpers

package
v0.0.0-...-3255acc Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

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 fn.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