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

Switch test/*.go to using YAML rather than structs #4288

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

abayer
Copy link
Contributor

@abayer abayer commented Oct 7, 2021

Changes

fixes #4276

/kind cleanup

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in or deleted (only if no user facing changes)

Release Notes

NONE

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 7, 2021
@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

/assign @pritidesai

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

/test check-pr-has-kind-label

@abayer abayer force-pushed the yaml-in-test branch 2 times, most recently from fe002dd to 0ed21eb Compare October 7, 2021 18:04
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

/remove-kind cleanup
/kind cleanup

@tekton-robot tekton-robot removed the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Oct 7, 2021
@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Oct 7, 2021
@pritidesai
Copy link
Member

thanks @abayer

Note that test/pipelinefinally_test.go is largely not converted to YAML,
because it relies heavily on parameterized generation of Tasks andPipelines,
to the point where it would be far more complicated to switch to YAML than to
leave it as is.

Indeed, avoiding repeatability landed us here 🤦‍♀️ I would still prefer going towards YAML route if possible 🙏

@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

/test pull-kind-label

@abayer
Copy link
Contributor Author

abayer commented Oct 7, 2021

@pritidesai Yeah, pipelinefinally_test.go is just a fair amount of work to change to not being so parameterized, and I wanted to get the bulk of the work done first, at least. I'll probably refactor it in a followup PR.

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

volumes:
- name: bucket-secret-volume
secret:
secretName: bucket-secret
Copy link
Member

Choose a reason for hiding this comment

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

NIT: this will be %s instead of a literal bucket-secret, its a common name defined as a constant so results in the same specifications but since we have it parameterized 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooops - that was an oversight! I was generating the more complicated YAML via marshaling/editing for parameterization, and missed that one. Fixing now!

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

@abayer
Copy link
Contributor Author

abayer commented Oct 8, 2021

@pritidesai - latest force-push dealt with pipelinefinally_test.go. =)

@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
test/yaml.go 0.0% 19.2% 19.2

@abayer
Copy link
Contributor Author

abayer commented Oct 8, 2021

Ok, test/v1alpha1/... has been switched now too!

@abayer
Copy link
Contributor Author

abayer commented Oct 10, 2021

/retest

@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 Oct 11, 2021
@abayer
Copy link
Contributor Author

abayer commented Oct 11, 2021

/hold
Waiting for @pritidesai to slog through reviewing the giant pile of changes to make sure I didn't do anything too stupid. =)

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 11, 2021
params:
- name: the.path
type: string
- name: the.dest
Copy link
Member

Choose a reason for hiding this comment

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

NIT: the param name changed here 🙃 dest to the.dest but the param reference has changed as well on line 191 so we are good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops. =)

name: %s
spec:
resources:
inputs:
Copy link
Member

Choose a reason for hiding this comment

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

alpha task specification include spec.inputs.resources and spec.outputs.resources, here we have spec.resources.inputs and spec.resources.outputs. All the alpha resources are anyways converted to beta before processing, so having this spec in beta format should work. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Everywhere else in v1alpha, I used the alpha syntax, so I'll change this to match.

steps:
- command: ['/workspace/hellowrld/newfile']
image: ubuntu
name: runfile
Copy link
Member

Choose a reason for hiding this comment

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

image is runfile and name is addfile, interesting choices 😄 @abayer do you want to stick to the original values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the original values. =)

taskRef:
name: %s
- name: runfile
from:
Copy link
Member

Choose a reason for hiding this comment

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

this from belongs to resources.inputs[].helloworldgit 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! Fixed.

name: %s
workspaces:
- name: test
workspace: 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: subpath is missing here, but since its set to an empty string, should be ok to leave it unset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I generally skipped empty string cases like that.

workspaces:
- name: test
description: 'test workspace'
mountPath: /workspace/test
Copy link
Member

Choose a reason for hiding this comment

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

mountPath is set to /workspace/test instead of /workspace/test/file here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

name: %s
workspaces:
- name: test
workspace: foo
Copy link
Member

Choose a reason for hiding this comment

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

subpath not set here, similar to the comment ⬆️ , should be fine to leave it unset.

spec:
steps:
- image: alpine
script: 'echo foo > /workspace/test/file'
Copy link
Member

Choose a reason for hiding this comment

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

the script is set to different statement compared to original script, cat /workspace/test/file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing!

spec:
steps:
- image: alpine
script: 'echo foo > /workspace/test/file'
Copy link
Member

Choose a reason for hiding this comment

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

similar to the comment above, the script is set to a different statement but looks like it should be ok since its not adding any value in the test anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still, just for consistency, I'll change it.

@pritidesai
Copy link
Member

thanks @abayer for all the hard work on this, I finally finished reviewing all the changes 😓 I have left a few comments. I doubt any of them are blocking since the tests are running fine unless those changes are not necessary or adding any value in terms of validating the functionality 😜

let me know your thoughts ...

I am ready to merge this 💯

fixes tektoncd#4276

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@abayer
Copy link
Contributor Author

abayer commented Oct 12, 2021

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 12, 2021
@abayer
Copy link
Contributor Author

abayer commented Oct 12, 2021

@pritidesai Ok, nits addressed, and I've taken it off hold!

@pritidesai
Copy link
Member

alright, thanks a bunch @abayer once again 🙏

Lets merge this 🎉

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2021
@pritidesai
Copy link
Member

/test pull-tekton-pipeline-alpha-integration-tests

@tekton-robot tekton-robot merged commit 38b9f26 into tektoncd:main Oct 12, 2021
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

start using YAMLParsers in /test/*_test.go
4 participants