testing

package
v0.0.0-...-75b8dd2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuzzIters = flag.Int("fuzz-iters", 20, "How many fuzzing iterations to do.")

Functions

func DefaultFuzzers

func DefaultFuzzers(t TestingCommon, codecFactory runtimeserializer.CodecFactory, fuzzerFuncs []interface{}) *fuzz.Fuzzer

func FuzzerFor

func FuzzerFor(funcs []interface{}, src rand.Source) *fuzz.Fuzzer

FuzzerFor can randomly populate api objects that are destined for version.

func GenericFuzzerFuncs

func GenericFuzzerFuncs(t TestingCommon, codecs runtimeserializer.CodecFactory) []interface{}

func MergeFuzzerFuncs

func MergeFuzzerFuncs(t TestingCommon, funcLists ...[]interface{}) []interface{}

MergeFuzzerFuncs will merge the given funcLists, overriding early funcs with later ones if there first argument has the same type.

func RoundTripProtobufTestForAPIGroup

func RoundTripProtobufTestForAPIGroup(t *testing.T, installFn InstallFunc, fuzzingFuncs []interface{})

RoundTripProtobufTestForAPIGroup is convenient to call from your install package to make sure that a "bare" install of your group provides enough information to round trip

func RoundTripProtobufTestForScheme

func RoundTripProtobufTestForScheme(t *testing.T, scheme *runtime.Scheme, fuzzingFuncs []interface{})

RoundTripProtobufTestForScheme is convenient to call if you already have a scheme and want to make sure that its well-formed

func RoundTripSpecificKind

func RoundTripSpecificKind(t *testing.T, internalGVK schema.GroupVersionKind, scheme *runtime.Scheme, codecFactory runtimeserializer.CodecFactory, fuzzer *fuzz.Fuzzer, nonRoundTrippableTypes map[schema.GroupVersionKind]bool)

func RoundTripSpecificKindWithoutProtobuf

func RoundTripSpecificKindWithoutProtobuf(t *testing.T, internalGVK schema.GroupVersionKind, scheme *runtime.Scheme, codecFactory runtimeserializer.CodecFactory, fuzzer *fuzz.Fuzzer, nonRoundTrippableTypes map[schema.GroupVersionKind]bool)

func RoundTripTestForAPIGroup

func RoundTripTestForAPIGroup(t *testing.T, installFn InstallFunc, fuzzingFuncs []interface{})

RoundTripTestForAPIGroup is convenient to call from your install package to make sure that a "bare" install of your group provides enough information to round trip

func RoundTripTestForScheme

func RoundTripTestForScheme(t *testing.T, scheme *runtime.Scheme, fuzzingFuncs []interface{})

RoundTripTestForScheme is convenient to call if you already have a scheme and want to make sure that its well-formed

func RoundTripTypes

func RoundTripTypes(t *testing.T, scheme *runtime.Scheme, codecFactory runtimeserializer.CodecFactory, fuzzer *fuzz.Fuzzer, nonRoundTrippableTypes map[schema.GroupVersionKind]bool)

func RoundTripTypesWithoutProtobuf

func RoundTripTypesWithoutProtobuf(t *testing.T, scheme *runtime.Scheme, codecFactory runtimeserializer.CodecFactory, fuzzer *fuzz.Fuzzer, nonRoundTrippableTypes map[schema.GroupVersionKind]bool)

RoundTripTypesWithoutProtobuf applies the round-trip test to all round-trippable Kinds in the scheme. It will skip all the GroupVersionKinds in the skip list.

func TestCodec

TestCodec returns the codec for the API version to test against, as set by the KUBE_TEST_API_TYPE env var.

func TestStorageCodec

func TestStorageCodec(codecs runtimeserializer.CodecFactory, gvs ...schema.GroupVersion) runtime.Codec

TestStorageCodec returns the codec for the API version to test against used in storage, as set by the KUBE_TEST_API_STORAGE_TYPE env var.

func ValueFuzz

func ValueFuzz(obj interface{})

ValueFuzz recursively changes all basic type values in an object. Any kind of references will not be touch, i.e. the addresses of slices, maps, pointers will stay unchanged.

Types

type InstallFunc

type InstallFunc func(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme)

type TestingCommon

type TestingCommon interface {
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

TestingCommon abstracts testing.T and testing.B

Jump to

Keyboard shortcuts

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