Documentation ¶
Index ¶
- Constants
- func DeleteResources(t *Harness, opts CreateDeleteTestOptions)
- func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured)
- func RunCreateDeleteTest(t *Harness, opt CreateDeleteTestOptions)
- func SetupNamespacesAndApplyDefaults(t *Harness, resources []*unstructured.Unstructured, project testgcp.GCPProject)
- func WaitForReady(h *Harness, timeout time.Duration, unstructs ...*unstructured.Unstructured)
- type CreateDeleteTestOptions
- type Harness
- func (h *Harness) CompareGoldenFile(p string, got string, normalizers ...func(s string) string)
- func (h *Harness) ExportParams() exportparameters.Parameters
- func (h *Harness) GetClient() client.Client
- func (h *Harness) GetRESTConfig() *rest.Config
- func (h *Harness) MustReadFile(p string) []byte
- func (h *Harness) NoExtraGoldenFiles(glob string)
- type HarnessOption
- type Sample
- type SampleKey
Constants ¶
View Source
const DefaultWaitForReadyTimeout = 35 * time.Minute
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, timeout time.Duration, 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 // CreateInOrder true means that we create each object and wait for the object to be ready. // This requires that objects be sorted in creation order. CreateInOrder 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 VCRRecorderNonTF *recorder.Recorder VCRRecorderTF *recorder.Recorder VCRRecorderOauth *recorder.Recorder // MockGCP holds our mockgcp instance, if we are running against mockgcp MockGCP mockgcp.Interface // contains filtered or unexported fields }
func NewHarness ¶
func NewHarnessWithManager ¶ added in v1.101.0
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 (*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) GetRESTConfig ¶ added in v1.118.2
func (*Harness) MustReadFile ¶ added in v1.111.0
func (*Harness) NoExtraGoldenFiles ¶ added in v1.114.1
type HarnessOption ¶ added in v1.125.0
type HarnessOption func(*Harness)
func FilterCRDs ¶ added in v1.125.0
func FilterCRDs(filterCRDs func(gk schema.GroupKind) bool) HarnessOption
func WithVCRPath ¶ added in v1.125.0
func WithVCRPath(vcrPath string) HarnessOption
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
LoadMatchingSamples loads the samples that match the regex
func LoadSample ¶ added in v1.113.0
LoadSample loads one sample
type SampleKey ¶ added in v1.113.0
SampleKey contains the metadata for a sample. This lets us defer variable substitution.
func ListAllSamples ¶ added in v1.113.0
ListAllSamples gets the keys for all the samples without loading them.
Click to show internal directories.
Click to hide internal directories.