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

Testing tools for Tekton Pipelines #1289

Open
bobcatfish opened this issue Sep 6, 2019 · 6 comments
Open

Testing tools for Tekton Pipelines #1289

bobcatfish opened this issue Sep 6, 2019 · 6 comments
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) design This task is about creating and discussing a design Epic Issues that should be considered as Epics (aka multiple sub-tasks, …) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@bobcatfish
Copy link
Collaborator

I'm not exactly sure what this looks like but I wanted to start tracking this here if ppl have ideas.

Basically I think that we should have a great testing story around Tekton Pipelines, e.g.:

  • People should be able to write "unit tests" for their Tasks and Pipelines (I have no idea what these would actually look like!)
  • People should be able to have some level of confidence in their Tasks without having to plug them into an entire Pipeline, run them, and observe what happened
  • People should be able to express what the intent of their Tasks is, and verify it in some way that isn't manual

For inspiration, I really like the way that OPA polices can have tests written for them: https://www.openpolicyagent.org/docs/latest/how-do-i-test-policies/ Unfortunately Tekton Pipelines is totally different b/c it isn't a language (or is it????) and it's mostly side effect driven (the whole point is to execute stuff that causes changes in the state of the world) but I feel confident that if we really spend some time thinking about this we can make something cool!

@bobcatfish bobcatfish added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. design This task is about creating and discussing a design Epic Issues that should be considered as Epics (aka multiple sub-tasks, …) labels Sep 6, 2019
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 12, 2020
@bobcatfish
Copy link
Collaborator Author

This is a roadmap item: https:/tektoncd/pipeline/blob/master/roadmap.md

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Aug 12, 2020
@bobcatfish bobcatfish added the area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) label Aug 24, 2020
@afrittoli afrittoli added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 17, 2021
@bobcatfish
Copy link
Collaborator Author

People should be able to write "unit tests" for their Tasks and Pipelines (I have no idea what these would actually look like!)

Quick passing thought - now that we have both params and results (and also workspaces), we could provide tools / libs to write "tests" that exercise Tasks and Pipelines with certain inputs and check for expected outputs and workspace contents. Maybe not as much of "unit test" as we'd like but probably a useful test for many cases 🤔

(Also wondering if there might be some overlap with the catalog tiers work @jerop )

@sfzylad
Copy link

sfzylad commented Mar 25, 2022

It would be great to have some mechanism for testing tasks and pipelines. I think there are two scenarios worth considering:

  1. testing against the task's or pipeline's results, maybe with a CR like TaskRunTest or PipelineRunTest that would take the TaskRun or PipelineRun definition and list of assertions to be tested and at the end indicate whether the assertions are satisfied.
  2. testing tasks outside of tekton. I think having a mechanism that can evaluate a TaskRun and execute task without deploying it into tekton could be useful. Something that will interpolate parameters and run the image and script from each step. Perhaps incorporating some form of tests like bats.

@vdemeester
Copy link
Member

It would be great to have some mechanism for testing tasks and pipelines. I think there are two scenarios worth considering:

  1. testing against the task's or pipeline's results, maybe with a CR like TaskRunTest or PipelineRunTest that would take the TaskRun or PipelineRun definition and list of assertions to be tested and at the end indicate whether the assertions are satisfied.
  2. testing tasks outside of tekton. I think having a mechanism that can evaluate a TaskRun and execute task without deploying it into tekton could be useful. Something that will interpolate parameters and run the image and script from each step. Perhaps incorporating some form of tests like bats.

For (2), something like buildkit-tekton could probably help 👼🏼

@cdbkr
Copy link

cdbkr commented Apr 6, 2022

This would be really helpful when maintaining a catalog with a lot of Tasks and Pipelines.
It would be great to be able to actually test the following scenarios in isolation (without a cluster):

  • Tasks:

    • interpolated variables coming from params (which could be optional/required)
    • order of steps
    • produces results
    • general task validation
  • Pipelines:

    • order of tasks execution (sync/parallel/chained)
    • tasks are configured properly respecting required/optional params
    • all params referred in the task configurations are actually declared in the pipeline's spec-params section
    • workspaces required by the tasks are actually declared in the pipeline
    • general pipeline validation

    I'm a bit puzzled whether this would be "configuration testing" or not but, something like this would really help automating checks/validations when maintaining a huge catalog of tasks/pipelines.
    Also, we had a look at https:/tektoncd/catlin and it might cover what I described above (not sure if that's what you are planning to do with that tool or if you'd like to enhance the testing tools separately).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) design This task is about creating and discussing a design Epic Issues that should be considered as Epics (aka multiple sub-tasks, …) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: Todo
Status: Todo
Development

No branches or pull requests

6 participants