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

Add Terminated, Running, and Waiting Container States to Test Builder #1591

Merged
merged 1 commit into from
Nov 19, 2019
Merged

Add Terminated, Running, and Waiting Container States to Test Builder #1591

merged 1 commit into from
Nov 19, 2019

Conversation

danielhelfand
Copy link
Member

@danielhelfand danielhelfand commented Nov 19, 2019

Closes #1549

Changes

Adds three new funcs to test builder to allow setting the container state for testing purposes around Tekton. The three new funcs correspond to the container states for a step: Terminating, Running, and Waiting.

As a follow up, I think removing the StateTerminated func from test builder would be appropriate, but there should be a formal announcement about it before any work is done towards that.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

N/A

@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 19, 2019
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Nov 19, 2019
@tekton-robot tekton-robot requested review from a user and vdemeester November 19, 2019 14:58
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 19, 2019
@ghost
Copy link

ghost commented Nov 19, 2019

/lgtm

@tekton-robot tekton-robot assigned ghost Nov 19, 2019
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/builder/task.go 82.6% 80.2% -2.4

@danielhelfand danielhelfand changed the title WIP: Add Terminated, Running, and Waiting Container States to Test Builder Add Terminated, Running, and Waiting Container States to Test Builder Nov 19, 2019
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 19, 2019
@danielhelfand
Copy link
Member Author

/retest

@imjasonh
Copy link
Member

I have no problem with the change, but I'm a little curious why it's needed. In this PR it seems to only be used in a unit test to check that the test builder works. What we'd really benefit from is a test that a PodStatus with waiting/running/terminated steps get translated to a TaskRunStatus correctly, which I believe we should already have somewhere.

That being said it's a small change, so if it helps you in some way or sets up a future test I'm all for it.

(Just as an aside, unrelated to this PR really, I don't really love the test builders. I find it perfectly reasonable to just create Go structs directly, and having to maintain a copy of the test builders and add -- or forget to add -- support in a test builder every time we add a new field to a type just adds overhead. But other people seem to like them, so 🤷)

@danielhelfand
Copy link
Member Author

danielhelfand commented Nov 19, 2019

@imjasonh We use this in CLI unit tests. I thought it might be helpful to make these available so that others could have an easier solution to find than what we did for the CLI.

I'm not the biggest fan of test builder either, but, as you say, they are used quite frequently by some. Thought this was a good use case of it though.

@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 19, 2019
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
test/builder/task.go 82.6% 80.2% -2.4

@ghost
Copy link

ghost commented Nov 19, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2019
@imjasonh
Copy link
Member

@imjasonh We use this in CLI unit tests. I thought it might be helpful to make these available so that others could have an easier solution to find than what we did for the CLI.

I'm not the biggest fan of test builder either, but, as you say, they are used quite frequently by some. Thought this was a good use case of it though.

Ah perfect, thanks for that clarification. 👍

/lgtm
/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ImJasonH

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2019
@tekton-robot tekton-robot merged commit 316c1db into tektoncd:master Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add More Properties for StepState for Testing
4 participants