testing

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 29 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPipelineRunConditionStatusAndReason added in v1.2.0

func CheckPipelineRunConditionStatusAndReason(
	t *testing.T,
	prStatus v1.PipelineRunStatus,
	expectedStatus corev1.ConditionStatus,
	expectedReason string,
)

func ChildPipelineViaClusterResolver added in v1.14.0

func ChildPipelineViaClusterResolver(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun)

ChildPipelineViaClusterResolver returns a parent Pipeline whose PipelineTask resolves its child Pipeline through the cluster resolver (rather than a local name ref), plus the resolved child Pipeline, the parent PipelineRun, and the expected child PipelineRun. The expected child PipelineRun carries only the resolved tekton.dev/pipeline label (its Spec is left empty because the reconciler stores the resolver ref, which tests don't reconstruct). Used by e2e tests for the child-pipeline-via-resolver path.

func ConfigMapFromTestFile

func ConfigMapFromTestFile(t *testing.T, name string) *corev1.ConfigMap

ConfigMapFromTestFile creates a v1.ConfigMap from a YAML file It loads the YAML file from the testdata folder.

func MixedPipelineRefSpecAndTaskRefInPipeline added in v1.14.0

func MixedPipelineRefSpecAndTaskRefInPipeline(t *testing.T, namespace, parentPipelineRunName string) (*v1.Task, *v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun, *v1.PipelineRun)

MixedPipelineRefSpecAndTaskRefInPipeline returns a parent Pipeline that mixes the three child kinds in one Pipeline: a pipelineRef child, an inline pipelineSpec child, and a regular taskRef task. It returns the referenced Task, the parent Pipeline, the standalone child Pipeline (the pipelineRef target), the parent PipelineRun, and the expected pipelineRef and pipelineSpec child PipelineRuns. Shared by unit and e2e tests for the mixed-children path.

func MultiplePipelineRefsInPipeline added in v1.14.0

func MultiplePipelineRefsInPipeline(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, []*v1.Pipeline, *v1.PipelineRun, []*v1.PipelineRun)

MultiplePipelineRefsInPipeline returns a parent Pipeline with two pipelineRef PipelineTasks (each targeting a standalone child Pipeline), the two child Pipelines, the parent PipelineRun, and the two expected child PipelineRuns. Shared by unit and e2e tests for the multi-child pipelineRef path.

func NestedPipelineRefsInPipeline added in v1.14.0

func NestedPipelineRefsInPipeline(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun, *v1.PipelineRun)

NestedPipelineRefsInPipeline creates a three-level nested pipeline structure using PipelineRef: Parent Pipeline (A) -> Child Pipeline (B) via PipelineRef -> Grandchild Pipeline (C) via PipelineRef Returns all three pipelines, the parent PipelineRun, expected child PipelineRun, and expected grandchild PipelineRun.

func NestedPipelinesInPipeline added in v1.6.0

func NestedPipelinesInPipeline(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun, *v1.PipelineRun)

NestedPipelinesInPipeline creates a three-level nested pipeline structure: Parent Pipeline -> Child Pipeline -> Grandchild Pipeline Returns the parent pipeline, parent pipelinerun, expected child pipelinerun, and expected grandchild pipelinerun

func NewAlphaFeatureFlagsConfigMapInSlice added in v1.3.0

func NewAlphaFeatureFlagsConfigMapInSlice() []*corev1.ConfigMap

func NewAlphaFeatureFlagsConfigMapWithMatrixInSlice added in v1.3.0

func NewAlphaFeatureFlagsConfigMapWithMatrixInSlice(count int) []*corev1.ConfigMap

func NewDefaultsCofigMapInSlice added in v1.3.0

func NewDefaultsCofigMapInSlice() []*corev1.ConfigMap

func NewFeatureFlagsConfigMapInSlice added in v1.3.0

func NewFeatureFlagsConfigMapInSlice() []*corev1.ConfigMap

func NewFeatureFlagsConfigMapWithMatrixInSlice added in v1.3.0

func NewFeatureFlagsConfigMapWithMatrixInSlice(count int) []*corev1.ConfigMap

func OnePipelineInPipeline added in v1.6.0

func OnePipelineInPipeline(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun)

OnePipelineInPipeline creates a single Pipeline with one child pipeline using PipelineSpec with TaskSpec. It also creates the according PipelineRun for it and the expected child PipelineRun against which the test will validate.

func OnePipelineRefInPipelineWithParamsAndWorkspaces added in v1.14.0

func OnePipelineRefInPipelineWithParamsAndWorkspaces(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun)

OnePipelineRefInPipelineWithParamsAndWorkspaces creates a parent Pipeline that references a child Pipeline via pipelineRef with both params and workspaces. It returns (parentPipeline, childPipeline, parentPipelineRun, expectedChildPipelineRun).

func OnePipelineRefMissing added in v1.14.0

func OnePipelineRefMissing(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.PipelineRun)

OnePipelineRefMissing returns a parent Pipeline that references a non-existent Pipeline by name, plus a PipelineRun that runs the parent. Shared by unit and e2e tests for the missing-child-pipeline failure path.

func OnePipelineRefMissingWorkspace added in v1.14.0

func OnePipelineRefMissingWorkspace(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun)

OnePipelineRefMissingWorkspace returns a parent Pipeline that references a child Pipeline declaring a workspace, where the parent omits the corresponding binding — so the child PipelineRun fails workspace validation.

func PipelineRefInFinally added in v1.14.0

func PipelineRefInFinally(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun)

PipelineRefInFinally returns a parent Pipeline with a main task and a finally PipelineTask that references a child Pipeline, plus the child Pipeline, the parent PipelineRun, and the expected finally child PipelineRun. Used by e2e tests for the pipelineRef-in-finally path.

func PipelineRefInPipelineWhenSkipped added in v1.14.0

func PipelineRefInPipelineWhenSkipped(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun)

PipelineRefInPipelineWhenSkipped returns a parent Pipeline whose only PipelineTask references a child Pipeline but is guarded by a when expression that evaluates to false, plus the child Pipeline and the parent PipelineRun. No child PipelineRun is expected. Shared by unit and e2e tests for the when-expression-skips-child path.

func PipelineRefWithPVCWorkspace added in v1.14.0

func PipelineRefWithPVCWorkspace(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun, *v1.PipelineRun)

PipelineRefWithPVCWorkspace returns a parent Pipeline that writes a file to a PVC-backed workspace and then maps that same workspace into a child Pipeline via pipelineRef, where a task in the child reads the file back. It returns the child Pipeline, the parent Pipeline, the parent PipelineRun (with a volumeClaimTemplate workspace), and the expected child PipelineRun. The parent only succeeds if the child sees the parent-written data, proving the volume is shared across the parent->child boundary. Used by e2e tests.

func SelfReferencingPipelineRefCycle added in v1.14.0

func SelfReferencingPipelineRefCycle(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.PipelineRun)

SelfReferencingPipelineRefCycle returns a Pipeline whose only PipelineTask has a pipelineRef back to itself, and a PipelineRun that runs it. The PipelineRun is pre-labelled with tekton.dev/pipeline so unit-level reconcile tests (which seed the run directly) exercise the cycle-detection label walk. Shared by unit and e2e tests for self-cycle detection.

func SetupDefaultContext added in v0.41.0

func SetupDefaultContext(t *testing.T) (context.Context, []controller.Informer)

SetupDefaultContext sets up the Context and the default filtered informers for the tests.

func SetupFakeCloudClientContext added in v0.42.0

func SetupFakeCloudClientContext(ctx context.Context, expectedEventCount int) context.Context

SetupFakeCloudClientContext sets up the fakeclient to context

func SetupFakeContext added in v0.8.0

func SetupFakeContext(t *testing.T) (context.Context, []controller.Informer)

SetupFakeContext sets up the Context and the fake filtered informers for the tests.

func TestLogger added in v0.8.0

func TestLogger(t *testing.T) *zap.SugaredLogger

TestLogger sets up the Logger

func TwoLevelPipelineRefCycle added in v1.14.0

func TwoLevelPipelineRefCycle(t *testing.T, namespace, parentPipelineRunName string) (*v1.Pipeline, *v1.Pipeline, *v1.PipelineRun)

TwoLevelPipelineRefCycle returns Pipelines pipeline-a and pipeline-b where each references the other via pipelineRef, plus a PipelineRun that runs pipeline-a. Shared by unit and e2e tests for two-level cycle detection.

func TwoPipelinesInPipelineMixedTasks added in v1.6.0

func TwoPipelinesInPipelineMixedTasks(t *testing.T, namespace, parentPipelineRunName string) (*v1.Task, *v1.Pipeline, *v1.PipelineRun, []*v1.PipelineRun)

TwoPipelinesInPipelineMixedTasks creates a parent Pipeline with two embedded child Pipelines: one using an embedded taskSpec and the other using a taskRef. It also creates a PipelineRun for the parent Pipeline, the expected child PipelineRuns for each child Pipeline and the referenced task.

func VerifyChildPipelineRunStatusesCount added in v1.6.0

func VerifyChildPipelineRunStatusesCount(t *testing.T, prStatus v1.PipelineRunStatus, expectedCount int)

func VerifyChildPipelineRunStatusesNames added in v1.6.0

func VerifyChildPipelineRunStatusesNames(t *testing.T, prStatus v1.PipelineRunStatus, expectedNames ...string)

func VerifyCustomRunOrRunStatusesCount added in v1.2.0

func VerifyCustomRunOrRunStatusesCount(t *testing.T, prStatus v1.PipelineRunStatus, expectedCount int)

func VerifyCustomRunOrRunStatusesNames added in v1.2.0

func VerifyCustomRunOrRunStatusesNames(t *testing.T, prStatus v1.PipelineRunStatus, expectedNames ...string)

func VerifyTaskRunStatusesCount added in v1.2.0

func VerifyTaskRunStatusesCount(t *testing.T, prStatus v1.PipelineRunStatus, expectedCount int)

func VerifyTaskRunStatusesNames added in v1.2.0

func VerifyTaskRunStatusesNames(t *testing.T, prStatus v1.PipelineRunStatus, expectedNames ...string)

func VerifyTaskRunStatusesWhenExpressions added in v1.2.0

func VerifyTaskRunStatusesWhenExpressions(t *testing.T, prStatus v1.PipelineRunStatus, trName string, expectedWhen []v1.WhenExpression)

func WithAnnotationAndLabel added in v1.6.0

func WithAnnotationAndLabel(pr *v1.PipelineRun, withUnused bool) *v1.PipelineRun

func WithLogger added in v0.8.0

func WithLogger(ctx context.Context, t *testing.T) context.Context

WithLogger returns the Logger

func WithServiceAccount added in v1.15.0

func WithServiceAccount(pr *v1.PipelineRun, serviceAccountName string) *v1.PipelineRun

WithServiceAccount sets serviceAccountName on the PipelineRun's taskRunTemplate. It decorates a fixture's PipelineRuns serviceAccountName in the TaskRunTemplate

Types

This section is empty.

Jump to

Keyboard shortcuts

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