testenv

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestEnvironment

type TestEnvironment struct {
	// contains filtered or unexported fields
}

TestEnvironment encapsulates the test environment for e2e tests.

func NewTestEnvironment

func NewTestEnvironment(ctx context.Context, cancelCtx context.CancelFunc, cl client.Client) *TestEnvironment

NewTestEnvironment creates a new TestEnvironment instance.

func (*TestEnvironment) CheckEtcdReady

func (t *TestEnvironment) CheckEtcdReady(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

CheckEtcdReady checks if the Etcd object is ready.

func (*TestEnvironment) CheckForDowntime

func (t *TestEnvironment) CheckForDowntime(g *WithT, namespace string, downtimeExpected bool)

CheckForDowntime checks the downtime from the zero downtime validator job.

func (*TestEnvironment) Client

func (t *TestEnvironment) Client() client.Client

Client returns the client of the test environment.

func (*TestEnvironment) Close

func (t *TestEnvironment) Close()

Close cancels the context of the test environment.

func (*TestEnvironment) Context

func (t *TestEnvironment) Context() context.Context

Context returns the context of the test environment.

func (*TestEnvironment) CreateAndCheckEtcd

func (t *TestEnvironment) CreateAndCheckEtcd(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

CreateAndCheckEtcd creates an etcd object and checks if it is ready.

func (*TestEnvironment) CreateTestNamespace

func (t *TestEnvironment) CreateTestNamespace(name string) error

CreateTestNamespace creates a namespace with the given name.

func (*TestEnvironment) DeleteAndCheckEtcd

func (t *TestEnvironment) DeleteAndCheckEtcd(g *WithT, logger logr.Logger, etcd *druidv1alpha1.Etcd, timeout time.Duration)

DeleteAndCheckEtcd deletes the Etcd object and checks if it is fully deleted.

func (*TestEnvironment) DeletePVCs

func (t *TestEnvironment) DeletePVCs(namespace string) error

DeletePVCs deletes all PVCs in the given namespace.

func (*TestEnvironment) DeleteTestNamespace

func (t *TestEnvironment) DeleteTestNamespace(name string) error

DeleteTestNamespace deletes the namespace with the given name.

func (*TestEnvironment) DeployEtcdLoaderJob

func (t *TestEnvironment) DeployEtcdLoaderJob(g *WithT, namespace, etcdClientServiceName string, etcdClientServicePort int32, etcdClientTLS *druidv1alpha1.TLSConfig, numKeys int64, timeout time.Duration)

DeployEtcdLoaderJob deploys the etcd loader job which loads keys into etcd.

func (*TestEnvironment) DeployZeroDowntimeValidatorJob

func (t *TestEnvironment) DeployZeroDowntimeValidatorJob(g *WithT, namespace, etcdClientServiceName string, etcdClientServicePort int32, etcdClientTLS *druidv1alpha1.TLSConfig, timeout time.Duration)

DeployZeroDowntimeValidatorJob deploys the zero downtime validator job.

func (*TestEnvironment) DisruptEtcd

func (t *TestEnvironment) DisruptEtcd(g *WithT, etcd *druidv1alpha1.Etcd, numPodsToDelete, numPVCsToDelete int, timeout time.Duration)

DisruptEtcd disrupts the etcd object by deleting its pods and/or deleting PVCs to simulate transient failures.

func (*TestEnvironment) EnsureCompaction

func (t *TestEnvironment) EnsureCompaction(g *WithT, etcdObjectMeta metav1.ObjectMeta, expectedFullSnapshotRevision, expectedDeltaSnapshotRevision int64, timeout time.Duration)

EnsureCompaction checks if compaction has succeeded by verifying the snapshot revisions.

func (*TestEnvironment) EnsureNoCompaction

func (t *TestEnvironment) EnsureNoCompaction(g *WithT, etcdObjectMeta metav1.ObjectMeta, expectedFullSnapshotRevision, expectedDeltaSnapshotRevision int64, duration time.Duration)

EnsureNoCompaction checks if compaction has not been triggered by verifying the snapshot revisions.

func (*TestEnvironment) GetEtcd

func (t *TestEnvironment) GetEtcd(name, namespace string) (*druidv1alpha1.Etcd, error)

GetEtcd returns the Etcd object with the given name and namespace.

func (*TestEnvironment) HibernateAndCheckEtcd

func (t *TestEnvironment) HibernateAndCheckEtcd(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

HibernateAndCheckEtcd hibernates the Etcd object and checks if it is in hibernated state.

func (*TestEnvironment) PrepareScheme

func (t *TestEnvironment) PrepareScheme() error

PrepareScheme adds the druidv1alpha1 scheme to the test environment's scheme.

func (*TestEnvironment) TakeDeltaSnapshot

func (t *TestEnvironment) TakeDeltaSnapshot(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

TakeDeltaSnapshot takes an on-demand delta snapshot of the etcd cluster using etcd-backup-restore server's HTTP API.

func (*TestEnvironment) TakeFullSnapshot

func (t *TestEnvironment) TakeFullSnapshot(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

TakeFullSnapshot takes an on-demand full snapshot of the etcd cluster using etcd-backup-restore server's HTTP API.

func (*TestEnvironment) TakeSnapshot

func (t *TestEnvironment) TakeSnapshot(g *WithT, etcd *druidv1alpha1.Etcd, snapshotType string, timeout time.Duration)

TakeSnapshot takes an on-demand snapshot of the etcd cluster using etcd-backup-restore server's HTTP API.

func (*TestEnvironment) UnhibernateAndCheckEtcd

func (t *TestEnvironment) UnhibernateAndCheckEtcd(g *WithT, etcd *druidv1alpha1.Etcd, replicas int32, timeout time.Duration)

UnhibernateAndCheckEtcd unhibernates the Etcd object and checks if it is in unhibernated state.

func (*TestEnvironment) UpdateAndCheckEtcd

func (t *TestEnvironment) UpdateAndCheckEtcd(g *WithT, etcd *druidv1alpha1.Etcd, timeout time.Duration)

UpdateAndCheckEtcd updates the Etcd object and checks if the update took effect.

func (*TestEnvironment) VerifyEtcdMemberPeerTLSEnabled

func (t *TestEnvironment) VerifyEtcdMemberPeerTLSEnabled(g *WithT, etcd *druidv1alpha1.Etcd)

VerifyEtcdMemberPeerTLSEnabled verifies that the Etcd member has the expected peer TLS enablement status.

func (*TestEnvironment) VerifyEtcdPodLabels

func (t *TestEnvironment) VerifyEtcdPodLabels(g *WithT, etcd *druidv1alpha1.Etcd, expectedLabels map[string]string)

VerifyEtcdPodLabels verifies that the Etcd pods have the expected labels.

Jump to

Keyboard shortcuts

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