Documentation
¶
Overview ¶
Package environment contains functions to handle the TestingEnvironment struct
Index ¶
- Constants
- type TestingEnvironment
- func (env TestingEnvironment) CreateUniqueTestNamespace(ctx context.Context, crudClient client.Client, namespacePrefix string, ...) (string, error)
- func (env TestingEnvironment) EventuallyExecCommand(ctx context.Context, pod corev1.Pod, containerName string, ...) (string, string, error)
- func (env *TestingEnvironment) MinimalImageName(tag string) string
- func (env *TestingEnvironment) OfficialMinimalImageName(tag string) string
- func (env *TestingEnvironment) OfficialStandardImageName(tag string) string
- func (env *TestingEnvironment) PostGISImageName(tag string) string
- func (env *TestingEnvironment) StandardImageName(tag string) string
Constants ¶
const ( // RetryTimeout retry timeout (in seconds) when a client api call or kubectl cli request get failed RetryTimeout = 60 // StandardSuffix is the suffix for standard images StandardSuffix = "standard-trixie" // MinimalSuffix is the suffix for minimal images MinimalSuffix = "minimal-trixie" // PostGISSuffix is the suffix for PostGIS images PostGISSuffix = "3-standard-trixie" )
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
PostgresImageName string
PostgresImageTag string
PostgresVersion uint64
PostgresImageRepository string
PostGISImageRepository string
// 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
func (*TestingEnvironment) MinimalImageName ¶ added in v1.25.4
func (env *TestingEnvironment) MinimalImageName(tag string) string
MinimalImageName returns the full image name for a minimal Postgres image. Example: ghcr.io/cloudnative-pg/postgresql:17-minimal-trixie
func (*TestingEnvironment) OfficialMinimalImageName ¶ added in v1.25.4
func (env *TestingEnvironment) OfficialMinimalImageName(tag string) string
OfficialMinimalImageName returns the full image name for the official CloudNativePG minimal Postgres image. This is used for major upgrade tests where source images must come from the official registry. Example: ghcr.io/cloudnative-pg/postgresql:16-minimal-trixie
func (*TestingEnvironment) OfficialStandardImageName ¶ added in v1.25.4
func (env *TestingEnvironment) OfficialStandardImageName(tag string) string
OfficialStandardImageName returns the full image name for the official CloudNativePG standard Postgres image. This is used for major upgrade tests where source images must come from the official registry. Example: ghcr.io/cloudnative-pg/postgresql:16-standard-trixie
func (*TestingEnvironment) PostGISImageName ¶ added in v1.25.4
func (env *TestingEnvironment) PostGISImageName(tag string) string
PostGISImageName returns the full image name for the official CloudNativePG PostGIS image. Example: ghcr.io/cloudnative-pg/postgis:17-3-standard-trixie
func (*TestingEnvironment) StandardImageName ¶ added in v1.25.4
func (env *TestingEnvironment) StandardImageName(tag string) string
StandardImageName returns the full image name for a standard Postgres image. Example: ghcr.io/cloudnative-pg/postgresql:17-standard-trixie