rtestutils

package
v0.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package rtestutils provides utilities for testing with resource API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAll

func AssertAll[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, assertionFunc func(r R, assertion *assert.Assertions))

AssertAll asserts on all resources of a kind.

func AssertNoResource

func AssertNoResource[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, id resource.ID)

AssertNoResource asserts that a resource no longer exists.

func AssertResources

func AssertResources[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, ids []resource.ID, assertionFunc func(r R, assertion *assert.Assertions))

AssertResources asserts on a resource list.

func Destroy

func Destroy[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, ids []string)

Destroy performs graceful teardown/destroy sequence for specified IDs.

func DestroyAll

func DestroyAll[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State)

DestroyAll performs graceful teardown/destroy sequence for all resources of type.

func ResourceIDs

func ResourceIDs[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, options ...state.ListOption) []resource.ID

ResourceIDs returns a list of resource IDs.

func ResourceIDsWithOwner

func ResourceIDsWithOwner[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, owner *string, options ...state.ListOption) []resource.ID

ResourceIDsWithOwner returns a list of resource IDs and filters them by owner (if set).

Types

type DestroyFn

type DestroyFn func(ctx context.Context, t *testing.T)

DestroyFn is function type used in BeginDestroy and BeginDestroyAll.

func BeginDestroy

func BeginDestroy[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State, ids []string) DestroyFn

BeginDestroy performs graceful teardown/destroy sequence for specified IDs. It returns the function to wait for the resource to be destroyed.

func BeginDestroyAll

func BeginDestroyAll[R ResourceWithRD](ctx context.Context, t *testing.T, st state.State) DestroyFn

BeginDestroyAll performs graceful teardown/destroy sequence for all resources of type. It returns the function to wait for the resource to be destroyed.

type ResourceWithRD

type ResourceWithRD interface {
	resource.Resource
	meta.ResourceDefinitionProvider
}

ResourceWithRD is a resource providing resource definition.

Jump to

Keyboard shortcuts

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