testutil

package
v0.0.0-...-e0434a4 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FixturesDir = "testdata"
)

Variables

This section is empty.

Functions

func BundleCompare

func BundleCompare(t *testing.T, bundleExpected, bundleActual *smith_v1.Bundle)

func BundleCompareContext

func BundleCompareContext(t *testing.T, fileName FileName, paramExpected, paramActual *smith_v1.Bundle)

func ContextWithLogger

func ContextWithLogger(t *testing.T) context.Context

func FileCompare

func FileCompare(t *testing.T, expectedFileName, actualFileName FileName, expectedData, actualData string) bool

functions like assert in that it returns true/false if there is no difference and marks the test as failed while allowing the test to continue

func JSONCompare

func JSONCompare(t *testing.T, expectedData, actualData interface{}) bool

Marshals both structs into JSON, compares them and prints text diff between them

func JSONCompareContext

func JSONCompareContext(t *testing.T, expectedFileName FileName, expectedData, actualData interface{}) bool

Marshals both structs into JSON, compares them and prints text diff between them. Accepts expectedFileName to print Unix patch that can be applied on top of the file.

func LoadFileFromTestData

func LoadFileFromTestData(filename string) ([]byte, error)

func LoadIntoStructFromTestData

func LoadIntoStructFromTestData(filename string, obj interface{}) error

func Named

func Named(name string) auth.User

func ObjectCompare

func ObjectCompare(t *testing.T, resActual, resExpected runtime.Object)

func ObjectCompareContext

func ObjectCompareContext(t *testing.T, fileName FileName, paramActual, paramExpected runtime.Object)

func PluginCompare

func PluginCompare(t *testing.T, resActual, resExpected *smith_v1.PluginSpec)

func PluginCompareContext

func PluginCompareContext(t *testing.T, fileName FileName, paramActual, paramExpected *smith_v1.PluginSpec)

func ReadCompare

func ReadCompare(t *testing.T, expectedFileName, actualFileName FileName, actualData string) bool

func ResourceCompare

func ResourceCompare(t *testing.T, resActual, resExpected *smith_v1.Resource)

func ResourceCompareContext

func ResourceCompareContext(t *testing.T, fileName FileName, paramActual, paramExpected *smith_v1.Resource)

func TextCompare

func TextCompare(t *testing.T, expectedTextName, actualTextName string, expectedText, actualText string) bool

func TextLinesCompare

func TextLinesCompare(t *testing.T, expectedTextName, actualTextName string, expectedLines, actualLines []string) bool

func YAMLCompare

func YAMLCompare(t *testing.T, expectedData, actualData interface{}) bool

Marshals both structs into YAML, compares them and prints text diff between them

func YAMLCompareContext

func YAMLCompareContext(t *testing.T, expectedFileName FileName, expectedData, actualData interface{}) bool

Marshals both structs into YAML, compares them and prints text diff between them. Accepts expectedFileName to print Unix patch that can be applied on top of the file.

Types

type FileName

type FileName string

Jump to

Keyboard shortcuts

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