-
-
Notifications
You must be signed in to change notification settings - Fork 8
Refactor update testdata script #296
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
base: main
Are you sure you want to change the base?
Conversation
testdata/GitHubActions.txt
Outdated
| GITHUB_SHA=99684bcacf01d95875834d87903dcb072306c9ad | ||
| GITHUB_HEAD_REF=main | ||
| GITHUB_EVENT_NAME=push | ||
| GITHUB_REF=??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing from this test case because GITHUB_REF is only relevant when a CI job is triggered on a tag.
We're missing a test case for when a build is triggered by a tag.
testdata/GitLab.txt
Outdated
| CI_COMMIT_SHA=123456789 | ||
| CI_COMMIT_BRANCH=main | ||
| CI_JOB_ID=713869896 | ||
| CI_COMMIT_TAG=??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing from this test case because CI_COMMIT_TAG is only relevant when a CI job is triggered on a tag.
We're also missing a test case for when a build is triggered by a tag.
testdata/GoCD.txt
Outdated
| GO_SCM_MY_MATERIAL_PR_BRANCH=aslakhellesoy:bug-fix-42 | ||
| GO_SCM_MY_MATERIAL_PR_URL=https://github.com/owner/repo/pull/1669 | ||
| GO_SCM_*_PR_BRANCH=??? | ||
| GO_SCM_*_PR_URL=??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The * matches the branch name. I.e: GO_SCM_MY_MATERIAL_PR_BRANCH So this is a limitation of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find.
It looks like update_testdata.rb got over taken by the complexity of different CI systems. The script effectively checks which variables are used in the bash-like substitutions in CiEnviornments.json. But this assumes all variables are always used or present, which is not the case.
I'll add a few test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some changes:
- Added test cases for Gitlab and Github to cover the situation where a tag is pushed.
- Moved the script to
testdatato keep concerns contained. - Moved the test data to
testdata/srcto keep it out of the concerns root. - Updated the integration tests to look for tests in
testdata/src
π€ What's changed?
β‘οΈ What's your motivation?
π·οΈ What kind of change is this?
β»οΈ Anything particular you want feedback on?
π Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.