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

Simplify variable substitution tests ⚗️ #1702

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

bobcatfish
Copy link
Collaborator

@bobcatfish bobcatfish commented Dec 6, 2019

Changes

Each test case for parameter substitution application was being given a
totally separate test case, with the variables being used being declared
in different places across the file. For #1639 I came along and wanted
to start adding more tests for workspace substitution and found it hard
to tell where to start so I:

  • Combined most of the test cases for param subsitution into one test
    so you can easily see everything that is being tested (none of the
    test cases conflicted with each other and can easily be applied
    together)
  • I kept the array param test cases separate cuz they seemd to be
    testing distinct test cases
  • The Volume test cases were a bit odd b/c they were trying to make sure
    substitution was applied to volumes, but there is no volume specific
    function so they were calling an internal function and passing in
    dummy values that are not representative of the actual values you'd
    substitute for volumes so instead I folded these test cases into the
    param application test.

Probably the resource application test case should be made quite similar
to the param test but it seemed like some of the resource stuff was
distinct and had to be tested in isolateion (e.g. just outputs, just
inputs, etc.)

Also removed some depreated (and duplicated!) volume tests:
in #1311 I removed support for ${} but instead of removing these tests
I just updated them, making them duplicates of the above test cases.

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.

Double check this list of stuff that's easy to miss:

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.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Dec 6, 2019
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 6, 2019
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 6, 2019
@bobcatfish bobcatfish changed the title Remove duplicated (deprecated) tests 💀 Simplify variable substitution tests ⚗️ Dec 6, 2019
Name: "$(inputs.params.FOO)",
},
},
}}, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation might be off here, I'd expect a }, { at the same indentation as Volumes: above.

ClaimName: "$(inputs.params.FOO)",
},
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same nit here: equally-indented }s just look wrong.

Name: "somethingelse",
Default: builder.ArrayOrString(""),
}}
want := applyMutation(simpleTaskSpec, func(spec *v1alpha1.TaskSpec) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applyMutation is grooooossss and we should get rid of it. But that's not for this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha its very "clever"

bobcatfish added a commit to bobcatfish/pipeline that referenced this pull request Dec 6, 2019
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
Same comment as @imjasonh on the indentation 😛

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2019
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
@bobcatfish
Copy link
Collaborator Author

I think I fixed the indentation, PTAL @vdemeester @imjasonh !

Use Golang they said... No one will ever have to argue about formatting again they said...

@vdemeester
Copy link
Member

Use Golang they said... No one will ever have to argue about formatting again they said...

Use any editor that can do goimports+gofmt on save 😛 and it is still true, no one argues, the CI fails that's all 😹 😝 👼

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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 Dec 10, 2019
Each test case for parameter substitution application was being given a
totally separate test case, with the variables being used being declared
in different places across the file. For tektoncd#1639 I came along and wanted
to start adding more tests for workspace substitution and found it hard
to tell where to start so I:

* Combined most of the test cases for param subsitution into one test
  so you can easily see everything that is being tested (none of the
  test cases conflicted with each other and can easily be applied
  together)
* I kept the array param test cases separate cuz they seemd to be
  testing distinct test cases
* The Volume test cases were a bit odd b/c they were trying to make sure
  substitution was _applied_ to volumes, but there is no volume specific
  function so they were calling an internal function and passing in
  dummy values that are not representative of the actual values you'd
  substitute for volumes so instead I folded these test cases into the
  param application test.

Probably the resource application test case should be made quite similar
to the param test but it seemed like some of the resource stuff was
distinct and had to be tested in isolateion (e.g. just outputs, just
inputs, etc.)

Also removed some depreated (and duplicated!) volume tests:
in tektoncd#1311 I removed support for ${} but instead of removing these tests
I just updated them, making them duplicates of the above test cases.
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 10, 2019
@tekton-robot tekton-robot merged commit 542287f into tektoncd:master Dec 10, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants