Skip to content

Commit 85ce1b3

Browse files
committed
test(third PR): add reconcile child pipeline tests
The test setup is a parent pipeline with one or more embedded child/grandchild pipelines using the `PipelineSpec` (alpha) field. It follows the given-when-then test flow arrangement. The pipeline manifests yaml definitions use variables for every field which is validated. Multiple helper functions were created equal to reconciliation unit tests for TaskRuns/CustomRuns: - `testing.OnePipelineInPipeline` - `testing.TwoPipelinesInPipelineMixedTasks` - `testing.NestedPipelinesInPipeline` - `parse.MustParseChildPipelineRunWithObjectMeta` - `reconcileOncePinP` - `validatePinP` - `getChildPipelineRunsForPipelineRun` - `getChildPipelineRunByName` - `validateChildPipelineRunCount` - `getChildPipelineRunByName` - `testing.VerifyChildPipelineRunStatusesCount` - `testing.VerifyChildPipelineRunStatusesNames` - `testing.childPipelineRunWithObjectMeta` Test data factory functions were put in the `testing` package in the `factory.go` file. The test validates: - the status and condition of the parent PipelineRuns which should trigger the creation of the child PipelineRuns, - the actual created child/grandchild PipelineRuns if they have the correct metadata i.e. name, owner reference, etc. and the embedded pipelines from the `PipelineSpec` fields in the pipeline tasks of the parent pipeline. Similar checks are performed in `TestReconcile` for `TaskRun` and in `TestReconcile_V1Beta1CustomTask` for `CustomTasks`. Add annotations/label propagation tests: - `TestReconcile_PropagateLabelsAndAnnotationsToChild` - `TestReconcile_ChildPipelineRunHasDefaultLabels` Aadd child pipeline creation error tests. New table driven test `TestReconcile_ChildPipelineRunCreationError` and test framework additions: - `type clientErrors` - `reconcileWithError` `reconcileWithError` can be reused in every test with fake client error returns i.e. where `Pipeline.PrependReactor` is used. Add e2e child pipeline tests. The test setup is a parent pipeline with one or more embedded child/grandchild pipelines using the `PipelineSpec` (alpha) field equal to the reconciliation unit tests. The e2e tests also follow the Given-When-Then test structure. The pipeline manifests yaml definitions use variables for every field which is validated. Multiple helper functions were created equal to PipelineRun e2e tests: - `setupPinP` - `tearDownOptDump` - `createKindsMap` - `assertPinP` - `createResourcesAndWaitForPipelineRun` - `checkLabelPropagationToChildPipelineRun` - `checkAnnotationPropagationToChildPipelineRun` - `assertEvents` The tests validate: - parent PipelineRun creation, - child PipelineRun creation, - successful finish of all resources, - correct label and annotation propagation, - amount of events published. Similar checks are performed in `TestPipelineRun|TestPipelineRunStatusSpec|...` for `TaskRun` and in `TestCustomTask` for `CustomTask`. Issues tektoncd#8760, tektoncd#7166 Signed-off-by: Stanislav Jakuschevskij <stas@two-giants.com>
1 parent fe8ac03 commit 85ce1b3

File tree

6 files changed

+1190
-0
lines changed

6 files changed

+1190
-0
lines changed

0 commit comments

Comments
 (0)