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

Remove bazel from test process, use 'terraform fmt' 'go test' #97

Merged

Conversation

sallyom
Copy link
Contributor

@sallyom sallyom commented Aug 1, 2018

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

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 1, 2018
@coreosbot
Copy link

Can one of the admins verify this patch?

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 1, 2018
Copy link
Member

@wking wking left a 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.

if [ "$FAILED" != "" ]; then
exit 1
fi
echo cli_units passed
Copy link
Member

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.

bazel --output_base=.cache build tarball
tar -zxf bazel-bin/tectonic-dev.tar.gz
cd tectonic-dev || exit 1
PATH=$(pwd)/installer:$PATH
Copy link
Member

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?)?

Copy link
Contributor Author

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

@sallyom sallyom force-pushed the remove-bazel-from-tests branch 2 times, most recently from 68ad409 to b772f38 Compare August 3, 2018 13:29
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 3, 2018
@sallyom sallyom force-pushed the remove-bazel-from-tests branch from b772f38 to 970c45d Compare August 3, 2018 13:32
hack/gotest.sh Outdated
@@ -0,0 +1,14 @@
#!/bin/sh

CGO_ENABLED=0
Copy link
Member

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

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, yes thanks

hack/gotest.sh Outdated
cd installer/pkg
PKGS=$(go list ./...)
for p in $PKGS; do
go test "$p" -cover
Copy link
Member

@wking wking Aug 3, 2018

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

Copy link
Contributor Author

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

@sallyom sallyom force-pushed the remove-bazel-from-tests branch 2 times, most recently from bcc9653 to 6e1b638 Compare August 4, 2018 19:42
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 4, 2018
@sallyom sallyom force-pushed the remove-bazel-from-tests branch from 6e1b638 to 815b44b Compare August 4, 2018 19:53
@sallyom sallyom changed the title WIP: Remove bazel from test process Remove bazel from test process, use 'terraform fmt' 'go test' Aug 4, 2018
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 4, 2018
@sallyom sallyom force-pushed the remove-bazel-from-tests branch 3 times, most recently from e3dae39 to 57b9fe5 Compare August 6, 2018 20:44
.travis.yml Outdated
- script: ./hack/tf-fmt.sh
name: Terraform format
- script: ./hack/gotest.sh
name: go test
Copy link
Member

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?

Copy link
Contributor Author

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

@sallyom sallyom force-pushed the remove-bazel-from-tests branch 5 times, most recently from 051455d to 0073869 Compare August 8, 2018 20:00
@sallyom sallyom force-pushed the remove-bazel-from-tests branch from 0073869 to b8a9bbc Compare August 8, 2018 20:07
@yifan-gu
Copy link
Contributor

yifan-gu commented Aug 9, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 9, 2018
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 9, 2018
@openshift-merge-robot openshift-merge-robot merged commit 745b56c into openshift:master Aug 9, 2018
wking added a commit to wking/openshift-installer that referenced this pull request Aug 15, 2018
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
wking added a commit to wking/openshift-installer that referenced this pull request Aug 28, 2018
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)
miyamotoh pushed a commit to miyamotoh/installer that referenced this pull request Jan 20, 2022
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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants