builderstest_test

package
v0.0.0-...-1e8dc9b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChaosPodBuilder

type ChaosPodBuilder struct {
	*v1.Pod
	// contains filtered or unexported fields
}

ChaosPodBuilder is a struct used to build a chaos pod instance.

func NewPodBuilder

func NewPodBuilder(podName, namespace string) *ChaosPodBuilder

NewPodBuilder creates a new ChaosPodBuilder instance with initial pod configuration.

func (*ChaosPodBuilder) Build

func (b *ChaosPodBuilder) Build() v1.Pod

Build generates a v1.Pod instance based on the configuration.

func (*ChaosPodBuilder) Reset

func (b *ChaosPodBuilder) Reset() *ChaosPodBuilder

Reset resets the ChaosPodBuilder by clearing all modifiers.

func (*ChaosPodBuilder) WithChaosFinalizer

func (b *ChaosPodBuilder) WithChaosFinalizer() *ChaosPodBuilder

WithChaosFinalizer sets the ChaosPodFinalizer.

func (*ChaosPodBuilder) WithChaosPodLabels

func (b *ChaosPodBuilder) WithChaosPodLabels(name, namespace, target, kind string) *ChaosPodBuilder

WithChaosPodLabels sets chaos-related labels.

func (*ChaosPodBuilder) WithChaosSpec

func (b *ChaosPodBuilder) WithChaosSpec(targetNodeName string, terminationGracePeriod, activeDeadlineSeconds int64, args []string, hostPathDirectory, pathFile v1.HostPathType, serviceAccountName string, image string) *ChaosPodBuilder

WithChaosSpec sets the chaos-specific pod spec.

func (*ChaosPodBuilder) WithContainerStatuses

func (b *ChaosPodBuilder) WithContainerStatuses(statuses []v1.ContainerStatus) *ChaosPodBuilder

WithContainerStatuses sets the container statuses to the status.

func (*ChaosPodBuilder) WithCreation

func (b *ChaosPodBuilder) WithCreation(past time.Duration) *ChaosPodBuilder

WithCreation adjusts the creation timestamp.

func (*ChaosPodBuilder) WithDeletion

func (b *ChaosPodBuilder) WithDeletion() *ChaosPodBuilder

WithDeletion sets the deletion timestamp to the current time.

func (*ChaosPodBuilder) WithLabels

func (b *ChaosPodBuilder) WithLabels(labels map[string]string) *ChaosPodBuilder

WithLabels sets custom labels.

func (*ChaosPodBuilder) WithPullSecrets

func (b *ChaosPodBuilder) WithPullSecrets(imagePullSecrets []v1.LocalObjectReference) *ChaosPodBuilder

WithPullSecrets sets image pull secrets to the spec.

func (*ChaosPodBuilder) WithStatus

func (b *ChaosPodBuilder) WithStatus(status v1.PodStatus) *ChaosPodBuilder

WithStatus sets the status.

func (*ChaosPodBuilder) WithStatusPhase

func (b *ChaosPodBuilder) WithStatusPhase(phase v1.PodPhase) *ChaosPodBuilder

WithStatusPhase sets the status phase.

type DisruptionBuilder

type DisruptionBuilder struct {
	*v1beta1.Disruption
	// contains filtered or unexported fields
}

DisruptionBuilder is a struct used to build a disruption instance.

func NewDisruptionBuilder

func NewDisruptionBuilder() *DisruptionBuilder

NewDisruptionBuilder creates a new DisruptionBuilder instance with an initial disruption spec and a creation timestamp modifier.

func (*DisruptionBuilder) Build

Build generates a v1.Disruption instance based on the configuration.

func (*DisruptionBuilder) Reset

Reset resets the DisruptionBuilder by clearing all modifiers.

func (*DisruptionBuilder) WithCount

func (b *DisruptionBuilder) WithCount(count *intstr.IntOrString) *DisruptionBuilder

WithCount sets the specified count.

func (*DisruptionBuilder) WithCreationDuration

func (b *DisruptionBuilder) WithCreationDuration(past time.Duration) *DisruptionBuilder

WithCreationDuration adjusts the creation timestamp.

func (*DisruptionBuilder) WithCreationTime

func (b *DisruptionBuilder) WithCreationTime(creationTimestamp time.Time) *DisruptionBuilder

WithCreationTime adjusts the creation timestamp.

func (*DisruptionBuilder) WithDeletion

func (b *DisruptionBuilder) WithDeletion() *DisruptionBuilder

WithDeletion sets the deletion timestamp to the current time.

func (*DisruptionBuilder) WithDisruptionKind

func (b *DisruptionBuilder) WithDisruptionKind(kind types.DisruptionKindName) *DisruptionBuilder

WithDisruptionKind sets the specified kind of disruption in the DisruptionBuilder's spec.

func (*DisruptionBuilder) WithDisruptionTriggers

func (b *DisruptionBuilder) WithDisruptionTriggers(triggers v1beta1.DisruptionTriggers) *DisruptionBuilder

WithDisruptionTriggers sets the specified triggers of disruption.

func (*DisruptionBuilder) WithDuration

WithDuration sets the duration timestamp.

func (*DisruptionBuilder) WithInjectionStatus

func (b *DisruptionBuilder) WithInjectionStatus(status types.DisruptionInjectionStatus) *DisruptionBuilder

WithInjectionStatus sets the specified injection status in the DisruptionBuilder's status.

func (*DisruptionBuilder) WithName

func (b *DisruptionBuilder) WithName(name string) *DisruptionBuilder

WithName sets the name.

func (*DisruptionBuilder) WithNamespace

func (b *DisruptionBuilder) WithNamespace(namespace string) *DisruptionBuilder

WithNamespace sets the namespace.

func (*DisruptionBuilder) WithNetworkDisableDefaultAllowedHosts

func (b *DisruptionBuilder) WithNetworkDisableDefaultAllowedHosts(enable bool) *DisruptionBuilder

WithNetworkDisableDefaultAllowedHosts set the NetworkDisruptionSpec to the network spec.

func (*DisruptionBuilder) WithNetworkDisruptionCloudSpec

func (b *DisruptionBuilder) WithNetworkDisruptionCloudSpec(spec *v1beta1.NetworkDisruptionCloudSpec) *DisruptionBuilder

WithNetworkDisruptionCloudSpec sets the NetworkDisruptionCloudSpecs to the Network spec.

func (*DisruptionBuilder) WithSpecPulse

func (b *DisruptionBuilder) WithSpecPulse(specPulse *v1beta1.DisruptionPulse) *DisruptionBuilder

WithSpecPulse sets the DisruptionPulse to the Pulse spec.

type PodBuilder

type PodBuilder struct {
	*v1.Pod // The built v1.Pod instance
	// contains filtered or unexported fields
}

PodBuilder is a struct used for building v1.Pod instances with modifications.

func (*PodBuilder) Parent

func (p *PodBuilder) Parent() PodsBuilder

Parent returns the parent PodsBuilder associated with the PodBuilder.

func (*PodBuilder) Terminated

func (p *PodBuilder) Terminated() *PodBuilder

Terminated sets the termination state of the container in the Pod to a terminated state with exit code 0.

func (*PodBuilder) TerminatedWith

func (p *PodBuilder) TerminatedWith(exitCode int32) *PodBuilder

TerminatedWith sets the termination state of the container in the Pod to a terminated state with the specified exit code.

type PodsBuilder

type PodsBuilder []*PodBuilder

PodsBuilder is a list of PodBuilder.

func NewPodsBuilder

func NewPodsBuilder() PodsBuilder

NewPodsBuilder creates a new PodsBuilder instance with predefined pod data.

func (PodsBuilder) Build

func (p PodsBuilder) Build() []v1.Pod

Build constructs and returns a slice of v1.Pod based on the configuration set in the PodsBuilder.

func (PodsBuilder) One

func (p PodsBuilder) One() *PodBuilder

One returns a pointer to a PodBuilder for the first pod in the PodsBuilder.

func (PodsBuilder) Take

func (p PodsBuilder) Take(index int) *PodBuilder

Take returns a pointer to a PodBuilder for the specified index from the PodsBuilder.

func (PodsBuilder) Two

func (p PodsBuilder) Two() *PodBuilder

Two returns a pointer to a PodBuilder for the second pod in the PodsBuilder.

Jump to

Keyboard shortcuts

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