-
Notifications
You must be signed in to change notification settings - Fork 496
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
Fix shell script tests #798
Conversation
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.
Other than that shellcheck thing, it looks good to me
/lgtm |
/hold |
/lgtm |
@hoegaarden -- can you rebase this? |
Fixes: ``` Step #2: /workspace/go/src/k8s.io/release/lib/gitlib.sh: line 137: export: `PROGSTEP[gitlib::github_acls]': not a valid identifier ```
@hoegaarden: Adding label: Reasons for blocking this PR:[Changes to certain release tools can affect our ability to test, build, and release Kubernetes. This PR must be explicitly approved by SIG Release repo admins.] Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
A few nits, but looks good overall!
lib/gitlib_test.sh
Outdated
@@ -8,6 +23,9 @@ source $TOOL_LIB_PATH/releaselib.sh | |||
|
|||
readonly TESTDATA="$( cd "$(dirname "$0")" && pwd )/testdata" | |||
|
|||
set -e |
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.
Prefer:
set -o errexit
set -o nounset
set -o pipefail
and set options immediately after file header.
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.
Yeah, we can do that when all the things we source ( == things we want to test and things they depend on [gitlib.sh
, common.sh
, releaselib.sh
]) don't run code that relies on undefined variables and doesn't ignore errors and all that jazz. When can we do that? When we have tests in place to refactor. I guess you see where I am going here ...
That's the best you'll get right now.
lib/releaselib_test.sh
Outdated
# shellcheck source=./lib/releaselib.sh | ||
source "${TOOL_LIB_PATH}/releaselib.sh" | ||
|
||
set -e |
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.
Prefer:
set -o errexit
set -o nounset
set -o pipefail
and set options immediately after file header.
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.
lib/releaselib_test.sh
Outdated
############################################################################## | ||
# END TESTING release::gcs::verify_latest_update() | ||
############################################################################## | ||
testMain "$@" |
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.
testMain "$@" | |
test_main "$@" |
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.
Why? fiiine ...
/hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hoegaarden, justaugustus, pswica 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 |
run them as either:
make test-sh
./lib/gitlib_test.sh
bazel test //lib/...
/cc @pswica @justaugustus