podbuilder

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeContainerID

func FakeContainerID() container.ID

func FakeContainerIDAtIndex added in v0.10.0

func FakeContainerIDAtIndex(index int) container.ID

func FakeContainerIDSet added in v0.10.0

func FakeContainerIDSet(size int) map[container.ID]bool

Types

type PodBuilder

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

Builds Pod objects for testing

The pod model should be internally well-formed (e.g., the containers in the PodSpec object should match the containers in the PodStatus object).

The pod model should also be consistent with the Manifest (e.g., if the Manifest specifies a Deployment with labels in a PodTemplateSpec, then any Pods should also have those labels).

The PodBuilder is responsible for making sure we create well-formed Pods for testing. Tests should never modify the pod directly, but instead use the PodBuilder methods to ensure that the pod is consistent.

func New

func New(t testing.TB, manifest model.Manifest) PodBuilder

func (PodBuilder) Build

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

func (PodBuilder) DeploymentUID added in v0.10.5

func (b PodBuilder) DeploymentUID() types.UID

func (PodBuilder) ManifestName added in v0.10.5

func (b PodBuilder) ManifestName() model.ManifestName

func (PodBuilder) ObjectTreeEntities added in v0.10.5

func (b PodBuilder) ObjectTreeEntities() []k8s.K8sEntity

Simulates a Pod -> ReplicaSet -> Deployment ref tree

func (PodBuilder) PodID added in v0.10.5

func (b PodBuilder) PodID() k8s.PodID

func (PodBuilder) RestartCount added in v0.10.5

func (b PodBuilder) RestartCount() int

func (PodBuilder) WithContainerID

func (b PodBuilder) WithContainerID(cID container.ID) PodBuilder

func (PodBuilder) WithContainerIDAtIndex added in v0.10.0

func (b PodBuilder) WithContainerIDAtIndex(cID container.ID, index int) PodBuilder

func (PodBuilder) WithContainerReady added in v0.10.15

func (b PodBuilder) WithContainerReady(ready bool) PodBuilder

func (PodBuilder) WithContainerReadyAtIndex added in v0.10.15

func (b PodBuilder) WithContainerReadyAtIndex(ready bool, index int) PodBuilder

func (PodBuilder) WithCreationTime

func (b PodBuilder) WithCreationTime(creationTime time.Time) PodBuilder

func (PodBuilder) WithDeletionTime added in v0.10.5

func (b PodBuilder) WithDeletionTime(deletionTime time.Time) PodBuilder

func (PodBuilder) WithDeploymentUID added in v0.10.5

func (b PodBuilder) WithDeploymentUID(deploymentUID types.UID) PodBuilder

func (PodBuilder) WithImage

func (b PodBuilder) WithImage(image string) PodBuilder

func (PodBuilder) WithImageAtIndex added in v0.10.0

func (b PodBuilder) WithImageAtIndex(image string, index int) PodBuilder

func (PodBuilder) WithNoTemplateSpecHash added in v0.10.16

func (b PodBuilder) WithNoTemplateSpecHash() PodBuilder

func (PodBuilder) WithPhase

func (b PodBuilder) WithPhase(phase string) PodBuilder

func (PodBuilder) WithPodID

func (b PodBuilder) WithPodID(podID string) PodBuilder

func (PodBuilder) WithPodLabel added in v0.10.5

func (b PodBuilder) WithPodLabel(key, val string) PodBuilder

func (PodBuilder) WithResourceVersion added in v0.10.19

func (b PodBuilder) WithResourceVersion(rv string) PodBuilder

func (PodBuilder) WithRestartCount added in v0.10.5

func (b PodBuilder) WithRestartCount(restartCount int) PodBuilder

func (PodBuilder) WithTemplateSpecHash added in v0.10.16

func (b PodBuilder) WithTemplateSpecHash(s k8s.PodTemplateSpecHash) PodBuilder

func (PodBuilder) WithUnknownOwner added in v0.17.7

func (b PodBuilder) WithUnknownOwner() PodBuilder

Remove the owner reference. Useful for testing pod watching when the owner chain is broken (as in some CRDs).

Jump to

Keyboard shortcuts

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