-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove bazel from test process, use 'terraform fmt' 'go test' #97
Remove bazel from test process, use 'terraform fmt' 'go test' #97
Conversation
Can one of the admins verify this patch? |
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.
I'd also like to update Travis to use the new scripts. I think that makes the motivation clearer, and also helps exercise the scripts before Prow picks them up. Not a big deal either way though.
hack/cli_units.sh
Outdated
if [ "$FAILED" != "" ]; then | ||
exit 1 | ||
fi | ||
echo cli_units passed |
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.
I think we can simplify this to:
if [ "$IS_CONTAINER" != "" ]; then
go test ./installer/...
else
docker ...
fi
If Prow needs success stdout, it can ./hack/cli_units.sh && echo 'cli_units passed'
. See the similar discussion here.
hack/terraform_fmt.sh
Outdated
bazel --output_base=.cache build tarball | ||
tar -zxf bazel-bin/tectonic-dev.tar.gz | ||
cd tectonic-dev || exit 1 | ||
PATH=$(pwd)/installer:$PATH |
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.
This seems like a lot of work to install Terraform, when the end result will be downloading it. Maybe there's a stock Terraform image we can use (the tflint image we already use?)?
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.
ah that would be great.. looking into it, yes, I know this is silly.. but I'm just getting my bearings with this codebase atm.. thanks
68ad409
to
b772f38
Compare
b772f38
to
970c45d
Compare
hack/gotest.sh
Outdated
@@ -0,0 +1,14 @@ | |||
#!/bin/sh | |||
|
|||
CGO_ENABLED=0 |
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.
You may need to export
this or move it to the go test ...
line:
$ ABC=1
$ env | grep ABC
$ ABC=1 env | grep ABC
ABC=1
$ export ABC=1
$ env | grep ABC
ABC=1
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.
whoops, yes thanks
hack/gotest.sh
Outdated
cd installer/pkg | ||
PKGS=$(go list ./...) | ||
for p in $PKGS; do | ||
go test "$p" -cover |
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.
We want to fail this script if any of these fail, and a for
loop makes that harder. I think you can just do:
if [ "$IS_CONTAINER" != "" ]; then
CGO_ENABLED=0 go test -cover ./installer/...
else
docker ...
fi
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.
yes, you are right. fixed
bcc9653
to
6e1b638
Compare
6e1b638
to
815b44b
Compare
e3dae39
to
57b9fe5
Compare
.travis.yml
Outdated
- script: ./hack/tf-fmt.sh | ||
name: Terraform format | ||
- script: ./hack/gotest.sh | ||
name: go test |
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.
Shouldn't these replace the "Terraform tests" and "Installer unit tests" entries below?
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.
yes they should, and now they do, thanks
051455d
to
0073869
Compare
CORS-749, CORS-750
0073869
to
b8a9bbc
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sallyom, yifan-gu 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 |
The script is from b8a9bbc (Remove bazel from test process, 2018-08-01, openshift#97), as part of moving tests from Travis to Prow. But Prow is already running our Go unit tests, via pull-ci-origin-installer-unit [1] with this config [2]. It's had that setup since openshift/release@eb11aa8b (Bump config to take advantage of canonical setup, 2018-06-06, openshift/release#921), so we don't need to replicate it here. [1]: https://github.com/openshift/release/blob/6f623b15854ae91203243af22d7a259ab85acd86/ci-operator/jobs/openshift/installer/openshift-installer-presubmits.yaml#L3-L28 [2]: https://github.com/openshift/release/blob/6f623b15854ae91203243af22d7a259ab85acd86/ci-operator/config/openshift/installer/master.json#L44
Eric points out potential issues with relabeling /tmp [1], which is shared by several system-level consumers. For the Bazel script, the /tmp mount is just since c483f59 (Move bazel build tarball test to prow, 2018-08-08, openshift#117), so we can drop it to return to our previous approach. The Terraform container seems to run fine without /tmp as well, although there's no clear history to point to on this front because we used to use Bazel for this. See b8a9bbc (Remove bazel from test process, 2018-08-01, openshift#97). [1]: openshift#174 (comment)
Merge 20220112
CORS-749, CORS-750
prow config for 'go test', 'terraform fmt' here: openshift/release#1152
Chipping away at the .travis.yml tasks, this PR moves Terraform fmt and Installer Unit Tests to Prow