environment

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package environment contains functions to handle the TestingEnvironment struct

Index

Constants

View Source
const (
	// RetryTimeout retry timeout (in seconds) when a client api call or kubectl cli request get failed
	RetryTimeout = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TestingEnvironment

type TestingEnvironment struct {
	RestClientConfig   *rest.Config
	Client             client.Client
	Interface          kubernetes.Interface
	APIExtensionClient apiextensionsclientset.Interface
	Ctx                context.Context
	Scheme             *runtime.Scheme
	Log                logr.Logger
	PostgresVersion    uint64
	// contains filtered or unexported fields
}

TestingEnvironment struct for operator testing

func NewTestingEnvironment

func NewTestingEnvironment() (*TestingEnvironment, error)

NewTestingEnvironment creates the environment for testing

func (TestingEnvironment) CreateUniqueTestNamespace

func (env TestingEnvironment) CreateUniqueTestNamespace(
	ctx context.Context,
	crudClient client.Client,
	namespacePrefix string,
	opts ...client.CreateOption,
) (string, error)

CreateUniqueTestNamespace creates a namespace by using the passed prefix. Return the namespace name and any errors encountered. The namespace is automatically cleaned up at the end of the test.

func (TestingEnvironment) EventuallyExecCommand

func (env TestingEnvironment) EventuallyExecCommand(
	ctx context.Context,
	pod corev1.Pod,
	containerName string,
	timeout *time.Duration,
	command ...string,
) (string, string, error)

EventuallyExecCommand wraps the utils.ExecCommand pre-setting values constant during tests, wrapping it with an Eventually clause

Jump to

Keyboard shortcuts

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