podbuilder

package
v0.33.13 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: 12 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

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() PodObjectTree

Simulates a Pod -> ReplicaSet -> Deployment ref tree

func (PodBuilder) PodName added in v0.20.2

func (b PodBuilder) PodName() k8s.PodID

func (PodBuilder) PodUID added in v0.20.2

func (b PodBuilder) PodUID() types.UID

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) WithContextNamespace added in v0.20.2

func (b PodBuilder) WithContextNamespace(ns k8s.Namespace) PodBuilder

WithContextNamespace sets the fallback namespace used if the entities in the manifest YAML do not specify any namespace.

This simulates having a namespace set on the active kubeconfig context, which Tilt also infers and uses, but is not explicitly accessible to PodBuilder.

If this is not set AND the entities do not reference a namespace, they will be assigned a namespace value of k8s.DefaultNamespace (`default`).

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) WithPodLabel added in v0.10.5

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

func (PodBuilder) WithPodName added in v0.20.2

func (b PodBuilder) WithPodName(name string) PodBuilder

func (PodBuilder) WithPodUID added in v0.20.2

func (b PodBuilder) WithPodUID(uid types.UID) 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).

type PodObjectTree added in v0.19.7

type PodObjectTree []k8s.K8sEntity

func (PodObjectTree) Deployment added in v0.19.7

func (p PodObjectTree) Deployment() k8s.K8sEntity

func (PodObjectTree) Pod added in v0.19.7

func (p PodObjectTree) Pod() k8s.K8sEntity

func (PodObjectTree) ReplicaSet added in v0.19.7

func (p PodObjectTree) ReplicaSet() k8s.K8sEntity

Jump to

Keyboard shortcuts

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