create

package
v1.116.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteResources added in v1.111.0

func DeleteResources(t *Harness, opts CreateDeleteTestOptions)

func MaybeSkip added in v1.101.0

func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured)

func RunCreateDeleteTest

func RunCreateDeleteTest(t *Harness, opt CreateDeleteTestOptions)

func SetupNamespacesAndApplyDefaults

func SetupNamespacesAndApplyDefaults(t *Harness, resources []*unstructured.Unstructured, project testgcp.GCPProject)

func WaitForReady added in v1.114.1

func WaitForReady(h *Harness, unstructs ...*unstructured.Unstructured)

Types

type CreateDeleteTestOptions added in v1.112.0

type CreateDeleteTestOptions struct {
	// Create is the set of objects to create
	Create []*unstructured.Unstructured

	// Updates is the set of objects to update (after all objects have been created)
	Updates []*unstructured.Unstructured

	// CleanupResources is true if we should delete resources when we are done
	CleanupResources bool

	// SkipWaitForDelete true means that we don't wait to query that a resource has been deleted.
	SkipWaitForDelete bool

	// SkipWaitForReady true is mainly used for Paused resources as we don't emit an event for those yet.
	SkipWaitForReady bool

	// DeleteInOrder true means that we delete each object and wait for deletion to complete.
	// This requires that objects be sorted in deletion order.
	DeleteInOrder bool
}

type Harness

type Harness struct {
	*testing.T
	Ctx context.Context

	Events     *test.MemoryEventSink
	KubeEvents *test.MemoryEventSink

	Project testgcp.GCPProject

	VCRRecorderDCL   *recorder.Recorder
	VCRRecorderTF    *recorder.Recorder
	VCRRecorderOauth *recorder.Recorder
	// contains filtered or unexported fields
}

func NewHarness

func NewHarness(ctx context.Context, t *testing.T) *Harness

func NewHarnessWithManager added in v1.101.0

func NewHarnessWithManager(ctx context.Context, t *testing.T, mgr manager.Manager) *Harness

NewHarnessWithManager builds a Harness for an existing manager. deprecated: Prefer NewHarness, which can construct a manager and mock gcp etc.

func (*Harness) CompareGoldenFile added in v1.111.0

func (h *Harness) CompareGoldenFile(p string, got string, normalizers ...func(s string) string)

func (*Harness) ExportParams added in v1.111.0

func (h *Harness) ExportParams() exportparameters.Parameters

ExportParams returns the default parameters.Parameters to use for an export

func (*Harness) GetClient

func (h *Harness) GetClient() client.Client

func (*Harness) MustReadFile added in v1.111.0

func (h *Harness) MustReadFile(p string) []byte

func (*Harness) NoExtraGoldenFiles added in v1.114.1

func (h *Harness) NoExtraGoldenFiles(glob string)

type Sample

type Sample struct {
	Name      string
	Resources []*unstructured.Unstructured
}

func LoadAllSamples added in v1.113.0

func LoadAllSamples(t *testing.T, project testgcp.GCPProject) []Sample

LoadAllSamples loads all the samples.

func LoadMatchingSamples added in v1.113.0

func LoadMatchingSamples(t *testing.T, regex *regexp.Regexp, project testgcp.GCPProject) []Sample

LoadMatchingSamples loads the samples that match the regex

func LoadSample added in v1.113.0

func LoadSample(t *testing.T, sampleKey SampleKey, project testgcp.GCPProject) Sample

LoadSample loads one sample

type SampleKey added in v1.113.0

type SampleKey struct {
	Name string
	// contains filtered or unexported fields
}

SampleKey contains the metadata for a sample. This lets us defer variable substitution.

func ListAllSamples added in v1.113.0

func ListAllSamples(t *testing.T) []SampleKey

ListAllSamples gets the keys for all the samples without loading them.

func ListMatchingSamples added in v1.113.0

func ListMatchingSamples(t *testing.T, regex *regexp.Regexp) []SampleKey

ListMatchingSamples gets the keys for all samples matching the regex, without loading them.

Jump to

Keyboard shortcuts

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