Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate PipelineRun Reconciler Tests to use YAMLParser #4610

Closed
21 of 62 tasks
jerop opened this issue Feb 22, 2022 · 13 comments
Closed
21 of 62 tasks

Migrate PipelineRun Reconciler Tests to use YAMLParser #4610

jerop opened this issue Feb 22, 2022 · 13 comments
Labels
area/epic Issues that should be considered as Epics (aka multiple sub-tasks, …) good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/misc Categorizes issue or PR as a miscellaneuous one. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@jerop
Copy link
Member

jerop commented Feb 22, 2022

YAML parsers take a YAML in a string and returns respective deserialized objects including Tasks, TaskRuns, Pipelines and PipelineRun - thank you @imjasonh 🎉

These parsers can help us simplify the many tests we have in pipelinerun_test.go, and make it easier to add more reconciler tests so that we can safely make changes to the reconciler, such as refactoring and supporting TEP-0090: Matrix.

Because the functions are long, we will use this issue to claim tests (to avoid duplicate work) and track progress. We'd appreciate any contributions to this migration 😸

cc @pritidesai


  • TestReconcile (@pritidesai) - cleaning up a unit test to use YAMLParser #4609
  • TestReconcile_CustomTask
  • TestReconcile_PipelineSpecTaskSpec - refactor TestReconcile_PipelineSpecTaskSpec objects #4622
  • TestReconcile_InvalidPipelineRuns - cleaning up a unit test InvalidPipelineRuns to use YAML parser #4616
  • TestReconcile_InvalidPipelineRunNames - no changes needed
  • TestReconcileOnCompletedPipelineRun
  • TestReconcileOnCancelledPipelineRunDeprecated
  • TestReconcileOnCancelledPipelineRun
  • TestReconcileForCustomTaskWithPipelineTaskTimedOut - @anu-baskar is working on this!
  • TestReconcileForCustomTaskWithPipelineRunTimedOut
  • TestReconcileOnCancelledRunFinallyPipelineRun
  • TestReconcileOnCancelledRunFinallyPipelineRunWithFinalTask
  • TestReconcileOnCancelledRunFinallyPipelineRunWithRunningFinalTask
  • TestReconcileOnCancelledRunFinallyPipelineRunWithFinalTaskAndRetries
  • TestReconcileCancelledRunFinallyFailsTaskRunCancellation
  • TestReconcileTaskResolutionError
  • TestReconcileOnStoppedRunFinallyPipelineRun
  • TestReconcileOnStoppedRunFinallyPipelineRunWithRunningTask
  • TestReconcileOnStoppedPipelineRunWithCompletedTask
  • TestReconcileOnPendingPipelineRun
  • TestReconcileWithTimeout
  • TestReconcileWithoutPVC
  • TestReconcileCancelledFailsTaskRunCancellation
  • TestReconcileCancelledPipelineRun
  • TestReconcilePropagateLabels
  • TestReconcilePropagateLabelsPending
  • TestReconcilePropagateLabelsCancelled
  • TestReconcileWithDifferentServiceAccounts
  • TestReconcileCustomTasksWithDifferentServiceAccounts
  • TestReconcileWithTimeoutAndRetry
  • TestReconcilePropagateAnnotations
  • TestGetTaskRunTimeout
  • TestGetFinallyTaskRunTimeout
  • TestReconcileAndPropagateCustomPipelineTaskRunSpec
  • TestReconcileCustomTasksWithTaskRunSpec
  • TestReconcileWithConditionChecks
  • TestReconcileWithFailingConditionChecks
  • TestReconcileWithWhenExpressionsWithParameters
  • TestReconcileWithWhenExpressionsWithTaskResults
  • TestReconcileWithWhenExpressionsScopedToTask
  • TestReconcileWithWhenExpressionsScopedToTaskWitResultRefs
  • TestReconcileWithAffinityAssistantStatefulSet
  • TestReconcileWithVolumeClaimTemplateWorkspace
  • TestReconcileWithVolumeClaimTemplateWorkspaceUsingSubPaths
  • TestReconcileWithTaskResults
  • TestReconcileWithTaskResultsEmbeddedNoneStarted
  • TestReconcileWithPipelineResults
  • Test_storePipelineSpec
  • TestReconcileOutOfSyncPipelineRun
  • TestUpdatePipelineRunStatusFromInformer
  • TestUpdatePipelineRunStatusFromTaskRuns
  • TestReconcilePipeline_FinalTasks
  • TestReconcile_CloudEvents - clean up TestReconcile_CloudEvents YAML parsing #4619
  • TestReconcilePipeline_TaskSpecMetadata
  • TestReconciler_ReconcileKind_PipelineTaskContext
  • TestReconcileWithTaskResultsInFinalTasks
  • TestReconcile_RemotePipelineRef
  • TestReconcile_OptionalWorkspacesOmitted
  • TestReconcile_DependencyValidationsImmediatelyFailPipelineRun

In addition to the YAML Parser migration, move these three tests to pipelinerunstate_test.go - these three tests are mainly testing func (state PipelineRunState) GetTaskRunsStatus:

@jerop jerop added area/epic Issues that should be considered as Epics (aka multiple sub-tasks, …) kind/misc Categorizes issue or PR as a miscellaneuous one. labels Feb 22, 2022
@lbernick
Copy link
Member

/label "help wanted"

@pritidesai
Copy link
Member

/help
/good-first-issue

@tekton-robot
Copy link
Collaborator

@pritidesai:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/help
/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Feb 23, 2022
@jbpratt
Copy link
Contributor

jbpratt commented Feb 25, 2022

I don't think TestReconcile_InvalidPipelineRunNames has any updates required

func TestReconcile_InvalidPipelineRunNames(t *testing.T) {
// TestReconcile_InvalidPipelineRunNames runs "Reconcile" on several PipelineRuns that have invalid names.
// It verifies that reconcile fails, how it fails and which events are triggered.
// Note that the code tested here is part of the genreconciler.
invalidNames := []string{
"foo/test-pipeline-run-doesnot-exist",
"test/invalidformat/t",
}
tcs := []struct {
name string
pipelineRun string
}{
{
name: "invalid-pipeline-run-shd-stop-reconciling",
pipelineRun: invalidNames[0],
}, {
name: "invalid-pipeline-run-name-shd-stop-reconciling",
pipelineRun: invalidNames[1],
},
}

@pritidesai
Copy link
Member

I don't think TestReconcile_InvalidPipelineRunNames has any updates required

Indeed, there are no changed needed in this test as part of this migration, thank you!

jbpratt added a commit to jbpratt/pipeline that referenced this issue Mar 17, 2022
Refactor the pipelineRun and taskRun create helpers to parse yaml.
Requires passing `*testing.T` through all calls.

continued work on tektoncd#4610

Signed-off-by: jbpratt <[email protected]>
jbpratt added a commit to jbpratt/pipeline that referenced this issue Mar 17, 2022
Refactor the pipelineRun and taskRun create helpers to parse yaml.
Requires passing `*testing.T` through all calls.

continued work on tektoncd#4610

Signed-off-by: jbpratt <[email protected]>
tekton-robot pushed a commit that referenced this issue Mar 18, 2022
Refactor the pipelineRun and taskRun create helpers to parse yaml.
Requires passing `*testing.T` through all calls.

continued work on #4610

Signed-off-by: jbpratt <[email protected]>
abayer added a commit to abayer/tektoncd-pipeline that referenced this issue Apr 12, 2022
This doesn't switch everything - the "global" tasks and other resources are left
as is, for example. But it does move most of the explicit `Task` and `TaskRun`
structs to parsed YAML instead.

Tangentially related to tektoncd#4610. =)

Signed-off-by: Andrew Bayer <[email protected]>
tekton-robot pushed a commit that referenced this issue Apr 14, 2022
This doesn't switch everything - the "global" tasks and other resources are left
as is, for example. But it does move most of the explicit `Task` and `TaskRun`
structs to parsed YAML instead.

Tangentially related to #4610. =)

Signed-off-by: Andrew Bayer <[email protected]>
chitrangpatel pushed a commit to chitrangpatel/pipeline that referenced this issue May 3, 2022
This doesn't switch everything - the "global" tasks and other resources are left
as is, for example. But it does move most of the explicit `Task` and `TaskRun`
structs to parsed YAML instead.

Tangentially related to tektoncd#4610. =)

Signed-off-by: Andrew Bayer <[email protected]>
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 13, 2022
@jerop
Copy link
Member Author

jerop commented Jun 13, 2022

/lifecycle frozen

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 13, 2022
@tekton-robot tekton-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Jun 13, 2022
@vsinghai
Copy link
Contributor

Wanted to bring to light that the YAML Parser cannot be used for tests in the v1beta1 package due to a circular dependency within the mustParse() function.

@JeromeJu
Copy link
Member

JeromeJu commented Jun 16, 2022

Noticed that most of the tests have been refactored thanks to #4749.
I would love to help update the checkboxes if necessary.

@jerop
Copy link
Member Author

jerop commented Jun 16, 2022

Noticed that most of the tests have been refactored thanks to #4749. I would love to help update the checkboxes if necessary.

yes please, thanks @JeromeJu

@JeromeJu
Copy link
Member

JeromeJu commented Jul 4, 2022

Due to the authorization issue, I am not able to edit on the issue itself. So instead leaving this comment to suggest closing this.

While some of tests might be outdated, the ones that are left could be marked completed.


Tests that might not require any updates.

  •  TestReconcileOnCancelledRunFinallyPipelineRun
  • TestReconcileOnCancelledRunFinallyPipelineRunWithFinalTaskAndRetries
  • TestReconcilePipeline_FinalTasks
  • TestGetTaskRunTimeout
  • TestGetFinallyTaskRunTimeout

Outdated:

  • TestReconcileCancelledRunFinallyFailsTaskRunCancellation
  • TestReconcileOnStoppedRunFinallyPipelineRun
  • TestReconcileOnStoppedRunFinallyPipelineRunWithRunningTask
  • TestReconcileOnStoppedPipelineRunWithCompletedTask
  • TestReconcileCancelledPipelineRun
  • TestReconcilePropagateLabelsCancelled
  • TestReconcilePropagateLabelsPending
  • TestReconcilePropagateAnnotations

To confirm:

  • TestReconcileTaskResolutionError

@talife
Copy link

talife commented Dec 2, 2022

Here's an updated list I compiled.
For TestUpdatePipelineRunStatusFromTaskRuns, mustParsePipelineRunTaskRunStatus is inside pipelinerun_updatestatus_test.go. Should the parser be extended instead ?

In addition to the YAML Parser migration, move these three tests to pipelinerunstate_test.go - these three tests are mainly testing func (state PipelineRunState) GetTaskRunsStatus:

@jerop
Copy link
Member Author

jerop commented Dec 13, 2022

Migration was completed, thank you for the contributions!

@jerop jerop closed this as completed Dec 13, 2022
Repository owner moved this from Todo to Done in Tekton Community Roadmap Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/epic Issues that should be considered as Epics (aka multiple sub-tasks, …) good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/misc Categorizes issue or PR as a miscellaneuous one. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: Done
Development

No branches or pull requests

8 participants