test

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FactByRecord

func FactByRecord(ctx context.Context, tx *sqlx.Tx, dt *db.DateTime, record reporting.Record) (*db.Fact, error)

func RequestRecorder

func RequestRecorder(t *testing.T, path string) (*http.Client, func(), error)

Types

type Suite

type Suite struct {
	suite.Suite

	NS      string
	Client  client.Client
	Config  *rest.Config
	Env     *envtest.Environment
	Logger  logr.Logger
	Context context.Context

	Scheme *runtime.Scheme

	DatabaseURL string
	// contains filtered or unexported fields
}

func (*Suite) EnsureNS

func (ts *Suite) EnsureNS(name string, labels map[string]string)

EnsureNS creates a new Namespace, validating the name in accordance with k8s validation rules.

func (*Suite) EnsureResources

func (ts *Suite) EnsureResources(resources ...client.Object)

EnsureResources ensures that the given resources are existing in the suite. Each error will fail the test.

func (*Suite) RegisterScheme

func (ts *Suite) RegisterScheme(addToScheme func(s *runtime.Scheme) error)

RegisterScheme passes the current scheme to the given SchemeBuilder func.

func (*Suite) SetupEnv

func (ts *Suite) SetupEnv(crdPaths []string)

func (*Suite) SetupSuite

func (ts *Suite) SetupSuite()

SetupSuite is used for setting up the testsuite before all tests are run. If you need to override it, make sure to call `SetupEnv()` first.

func (*Suite) SetupTest

func (ts *Suite) SetupTest()

SetupTest ensures a separate temporary DB for each test

func (*Suite) TearDownSuite

func (ts *Suite) TearDownSuite()

TearDownSuite implements suite.TearDownAllSuite. It is used to shut down the local envtest environment.

func (*Suite) TearDownTest

func (ts *Suite) TearDownTest()

TearDownTest cleans up temporary DB after each test

Jump to

Keyboard shortcuts

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