Documentation
¶
Index ¶
- func MakeBuildId(twdName, imageName string, podSpec *corev1.PodTemplateSpec) string
- func MakeCurrentVersion(namespace, twdName, imageName string, healthy, createDeployment bool) *temporaliov1alpha1.CurrentWorkerDeploymentVersion
- func MakeHelloWorldPodSpec(imageName string) corev1.PodTemplateSpec
- func MakePodSpec(containers []corev1.Container, labels map[string]string, taskQueue string) corev1.PodTemplateSpec
- func MakeTWD(name string, namespace string, replicas int32, podSpec corev1.PodTemplateSpec, ...) *temporaliov1alpha1.TemporalWorkerDeployment
- func MakeTWDWithImage(name, namespace, imageName string) *temporaliov1alpha1.TemporalWorkerDeployment
- func MakeTWDWithName(name, namespace string) *temporaliov1alpha1.TemporalWorkerDeployment
- func MakeTargetVersion(namespace, twdName, imageName string, rampPercentage float32, ...) temporaliov1alpha1.TargetWorkerDeploymentVersion
- func MakeVersionId(k8sNamespace, twdName, imageName string) string
- func ModifyObj[T any](obj T, callback func(obj T) T) T
- func ProgressiveStep(rampPercentage float32, pauseDuration time.Duration) temporaliov1alpha1.RolloutStep
- func RunHelloWorldWorker(ctx context.Context, podTemplateSpec corev1.PodTemplateSpec, ...)
- type DeprecatedVersionInfo
- type StatusBuilder
- func (sb *StatusBuilder) Build() *temporaliov1alpha1.TemporalWorkerDeploymentStatus
- func (sb *StatusBuilder) WithCurrentVersion(imageName string, healthy, createDeployment bool) *StatusBuilder
- func (sb *StatusBuilder) WithName(name string) *StatusBuilder
- func (sb *StatusBuilder) WithNamespace(k8sNamespace string) *StatusBuilder
- func (sb *StatusBuilder) WithTargetVersion(imageName string, rampPercentage float32, healthy bool, createDeployment bool) *StatusBuilder
- type TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) Build() *temporaliov1alpha1.TemporalWorkerDeployment
- func (b *TemporalWorkerDeploymentBuilder) WithAllAtOnceStrategy() *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithCurrentVersionStatus(imageName string, healthy, createDeployment bool) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithGate(expectSuccess bool) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithLabels(labels map[string]string) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithName(name string) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithNamespace(namespace string) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithProgressiveStrategy(steps ...temporaliov1alpha1.RolloutStep) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithReplicas(replicas int32) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithTargetVersionStatus(imageName string, rampPercentage float32, healthy, createDeployment bool) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithTemporalConnection(connectionName string) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithTemporalNamespace(temporalNamespace string) *TemporalWorkerDeploymentBuilder
- func (b *TemporalWorkerDeploymentBuilder) WithVersion(version string) *TemporalWorkerDeploymentBuilder
- type TestCase
- func (tc *TestCase) GetDeprecatedBuildImages() map[string]string
- func (tc *TestCase) GetDeprecatedBuildReplicas() map[string]int32
- func (tc *TestCase) GetExpectedStatus() *temporaliov1alpha1.TemporalWorkerDeploymentStatus
- func (tc *TestCase) GetTWD() *temporaliov1alpha1.TemporalWorkerDeployment
- func (tc *TestCase) GetWaitTime() *time.Duration
- type TestCaseBuilder
- func (tcb *TestCaseBuilder) Build() TestCase
- func (tcb *TestCaseBuilder) BuildWithValues(name, k8sNamespace, temporalNamespace string) TestCase
- func (tcb *TestCaseBuilder) WithDeprecatedBuilds(deprecatedVersionInfos ...DeprecatedVersionInfo) *TestCaseBuilder
- func (tcb *TestCaseBuilder) WithExpectedStatus(statusBuilder *StatusBuilder) *TestCaseBuilder
- func (tcb *TestCaseBuilder) WithInput(twdBuilder *TemporalWorkerDeploymentBuilder) *TestCaseBuilder
- func (tcb *TestCaseBuilder) WithWaitTime(waitTime time.Duration) *TestCaseBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeBuildId ¶
func MakeBuildId(twdName, imageName string, podSpec *corev1.PodTemplateSpec) string
MakeBuildId computes a build id based on the image and If no podSpec is provided, defaults to HelloWorldPodSpec with the given image name. If you provide your own podSpec, make sure to give the first container your desired image name if success is expected.
func MakeCurrentVersion ¶
func MakeCurrentVersion(namespace, twdName, imageName string, healthy, createDeployment bool) *temporaliov1alpha1.CurrentWorkerDeploymentVersion
func MakeHelloWorldPodSpec ¶
func MakeHelloWorldPodSpec(imageName string) corev1.PodTemplateSpec
MakeHelloWorldPodSpec creates a pod spec with hello_world task queue and one container with the given image name.
func MakePodSpec ¶
func MakePodSpec(containers []corev1.Container, labels map[string]string, taskQueue string) corev1.PodTemplateSpec
MakePodSpec creates a pod spec. Feel free to add parameters as needed.
func MakeTWD ¶
func MakeTWD( name string, namespace string, replicas int32, podSpec corev1.PodTemplateSpec, rolloutStrategy *temporaliov1alpha1.RolloutStrategy, sunsetStrategy *temporaliov1alpha1.SunsetStrategy, workerOpts *temporaliov1alpha1.WorkerOptions, ) *temporaliov1alpha1.TemporalWorkerDeployment
func MakeTWDWithImage ¶
func MakeTWDWithImage(name, namespace, imageName string) *temporaliov1alpha1.TemporalWorkerDeployment
func MakeTWDWithName ¶
func MakeTWDWithName(name, namespace string) *temporaliov1alpha1.TemporalWorkerDeployment
func MakeTargetVersion ¶
func MakeTargetVersion(namespace, twdName, imageName string, rampPercentage float32, healthy, createDeployment bool) temporaliov1alpha1.TargetWorkerDeploymentVersion
func MakeVersionId ¶
MakeVersionId computes a version id based on the image, HelloWorldPodSpec, and k8s namespace.
func ProgressiveStep ¶
func ProgressiveStep(rampPercentage float32, pauseDuration time.Duration) temporaliov1alpha1.RolloutStep
ProgressiveStep creates a progressive rollout step
func RunHelloWorldWorker ¶
func RunHelloWorldWorker(ctx context.Context, podTemplateSpec corev1.PodTemplateSpec, callback func(stopFunc func(), err error))
RunHelloWorldWorker runs one worker per replica in the pod spec. callback is a function that can be called multiple times.
Types ¶
type DeprecatedVersionInfo ¶
type DeprecatedVersionInfo struct {
// contains filtered or unexported fields
}
DeprecatedVersionInfo defines the necessary information about a deprecated worker version, so that tests can recreate state that is not visible in the TemporalWorkerDeployment status
func NewDeprecatedVersionInfo ¶
func NewDeprecatedVersionInfo(image string, replicas int32) DeprecatedVersionInfo
type StatusBuilder ¶
type StatusBuilder struct {
// contains filtered or unexported fields
}
StatusBuilder provides a fluent interface for building expected status objects Versions will be built based on the TWD name and k8s namespace
func NewStatusBuilder ¶
func NewStatusBuilder() *StatusBuilder
NewStatusBuilder creates a new status builder
func (*StatusBuilder) Build ¶
func (sb *StatusBuilder) Build() *temporaliov1alpha1.TemporalWorkerDeploymentStatus
Build returns the constructed status
func (*StatusBuilder) WithCurrentVersion ¶
func (sb *StatusBuilder) WithCurrentVersion(imageName string, healthy, createDeployment bool) *StatusBuilder
WithCurrentVersion sets the current version in the status
func (*StatusBuilder) WithName ¶
func (sb *StatusBuilder) WithName(name string) *StatusBuilder
WithName sets the name
func (*StatusBuilder) WithNamespace ¶
func (sb *StatusBuilder) WithNamespace(k8sNamespace string) *StatusBuilder
WithNamespace sets the namespace
func (*StatusBuilder) WithTargetVersion ¶
func (sb *StatusBuilder) WithTargetVersion(imageName string, rampPercentage float32, healthy bool, createDeployment bool) *StatusBuilder
WithTargetVersion sets the target version in the status. Target Version is required.
type TemporalWorkerDeploymentBuilder ¶
type TemporalWorkerDeploymentBuilder struct {
// contains filtered or unexported fields
}
TemporalWorkerDeploymentBuilder provides a fluent interface for building test TWD objects
func NewTemporalWorkerDeploymentBuilder ¶
func NewTemporalWorkerDeploymentBuilder() *TemporalWorkerDeploymentBuilder
NewTemporalWorkerDeploymentBuilder creates a new builder with sensible defaults
func (*TemporalWorkerDeploymentBuilder) Build ¶
func (b *TemporalWorkerDeploymentBuilder) Build() *temporaliov1alpha1.TemporalWorkerDeployment
Build returns the constructed TemporalWorkerDeployment
func (*TemporalWorkerDeploymentBuilder) WithAllAtOnceStrategy ¶
func (b *TemporalWorkerDeploymentBuilder) WithAllAtOnceStrategy() *TemporalWorkerDeploymentBuilder
WithAllAtOnceStrategy sets the rollout strategy to all-at-once
func (*TemporalWorkerDeploymentBuilder) WithCurrentVersionStatus ¶
func (b *TemporalWorkerDeploymentBuilder) WithCurrentVersionStatus(imageName string, healthy, createDeployment bool) *TemporalWorkerDeploymentBuilder
WithCurrentVersionStatus sets the status to have a current version
func (*TemporalWorkerDeploymentBuilder) WithGate ¶
func (b *TemporalWorkerDeploymentBuilder) WithGate(expectSuccess bool) *TemporalWorkerDeploymentBuilder
WithGate sets the rollout strategy have a gate workflow
func (*TemporalWorkerDeploymentBuilder) WithLabels ¶
func (b *TemporalWorkerDeploymentBuilder) WithLabels(labels map[string]string) *TemporalWorkerDeploymentBuilder
WithLabels sets the labels
func (*TemporalWorkerDeploymentBuilder) WithName ¶
func (b *TemporalWorkerDeploymentBuilder) WithName(name string) *TemporalWorkerDeploymentBuilder
WithName sets the name
func (*TemporalWorkerDeploymentBuilder) WithNamespace ¶
func (b *TemporalWorkerDeploymentBuilder) WithNamespace(namespace string) *TemporalWorkerDeploymentBuilder
WithNamespace sets the namespace
func (*TemporalWorkerDeploymentBuilder) WithProgressiveStrategy ¶
func (b *TemporalWorkerDeploymentBuilder) WithProgressiveStrategy(steps ...temporaliov1alpha1.RolloutStep) *TemporalWorkerDeploymentBuilder
WithProgressiveStrategy sets the rollout strategy to progressive with given steps
func (*TemporalWorkerDeploymentBuilder) WithReplicas ¶
func (b *TemporalWorkerDeploymentBuilder) WithReplicas(replicas int32) *TemporalWorkerDeploymentBuilder
WithReplicas sets the number of replicas
func (*TemporalWorkerDeploymentBuilder) WithTargetVersionStatus ¶
func (b *TemporalWorkerDeploymentBuilder) WithTargetVersionStatus(imageName string, rampPercentage float32, healthy, createDeployment bool) *TemporalWorkerDeploymentBuilder
WithTargetVersionStatus sets the status to have a target version
func (*TemporalWorkerDeploymentBuilder) WithTemporalConnection ¶
func (b *TemporalWorkerDeploymentBuilder) WithTemporalConnection(connectionName string) *TemporalWorkerDeploymentBuilder
WithTemporalConnection sets the temporal connection name
func (*TemporalWorkerDeploymentBuilder) WithTemporalNamespace ¶
func (b *TemporalWorkerDeploymentBuilder) WithTemporalNamespace(temporalNamespace string) *TemporalWorkerDeploymentBuilder
WithTemporalNamespace sets the temporal namespace
func (*TemporalWorkerDeploymentBuilder) WithVersion ¶
func (b *TemporalWorkerDeploymentBuilder) WithVersion(version string) *TemporalWorkerDeploymentBuilder
WithVersion sets the worker version (creates HelloWorld pod spec)
type TestCase ¶
type TestCase struct {
// contains filtered or unexported fields
}
func (*TestCase) GetDeprecatedBuildImages ¶
func (*TestCase) GetDeprecatedBuildReplicas ¶
func (*TestCase) GetExpectedStatus ¶
func (tc *TestCase) GetExpectedStatus() *temporaliov1alpha1.TemporalWorkerDeploymentStatus
func (*TestCase) GetTWD ¶
func (tc *TestCase) GetTWD() *temporaliov1alpha1.TemporalWorkerDeployment
func (*TestCase) GetWaitTime ¶
type TestCaseBuilder ¶
type TestCaseBuilder struct {
// contains filtered or unexported fields
}
TestCaseBuilder provides a fluent interface for building test cases
func NewTestCaseWithValues ¶
func NewTestCaseWithValues(name, k8sNamespace, temporalNamespace string) *TestCaseBuilder
NewTestCaseWithValues creates a new test case builder with the given values
func (*TestCaseBuilder) Build ¶
func (tcb *TestCaseBuilder) Build() TestCase
Build returns the constructed test case
func (*TestCaseBuilder) BuildWithValues ¶
func (tcb *TestCaseBuilder) BuildWithValues(name, k8sNamespace, temporalNamespace string) TestCase
BuildWithValues populates all fields affected by test name, k8s namespace, and temporal namespace and returns the constructed test case
func (*TestCaseBuilder) WithDeprecatedBuilds ¶
func (tcb *TestCaseBuilder) WithDeprecatedBuilds(deprecatedVersionInfos ...DeprecatedVersionInfo) *TestCaseBuilder
WithDeprecatedBuilds adds deprecated build replicas and images, indexed by the build id that the given image would result in
func (*TestCaseBuilder) WithExpectedStatus ¶
func (tcb *TestCaseBuilder) WithExpectedStatus(statusBuilder *StatusBuilder) *TestCaseBuilder
WithExpectedStatus sets the expected status
func (*TestCaseBuilder) WithInput ¶
func (tcb *TestCaseBuilder) WithInput(twdBuilder *TemporalWorkerDeploymentBuilder) *TestCaseBuilder
WithInput sets the input TWD
func (*TestCaseBuilder) WithWaitTime ¶
func (tcb *TestCaseBuilder) WithWaitTime(waitTime time.Duration) *TestCaseBuilder
WithWaitTime sets the wait time. Use this if you are expecting no change to the initial status and want to ensure that after some time, there is still no change.