Skip to content

Add Travis, linter, commit hooks and fix races - #13

Merged
dansimau merged 13 commits into
masterfrom
add-travis-linter-hooks
Dec 28, 2018
Merged

dansimau merged 13 commits into
masterfrom
add-travis-linter-hooks

Conversation

@dansimau

@dansimau dansimau commented Dec 27, 2018 •

Copy link
Copy Markdown
Contributor

Adds Travis configuration, a make lint and precommit hook for linting
locally.

This also fixes issues in the Makefile where make test was returning true
even when tests failed (due to shell pipe in Makefile) and where binaries
weren't rebuilt when source files changed.

Finally, this also fixes some race conditions that were showing up as flakey
tests. Namely, fixed a race in downloading of the Terraform binary and also
when creating download directories.

@dansimau dansimau self-assigned this Dec 27, 2018
* Put locking around the tvm Get() call instead of download(). This
should prevent multiple downloads from taking place due to the fact that
two threads both seeing that the requested Terraform version is not present
in the repository.

* Improve the mkdir calls. Instead of checking to see if a directory
exists before creating it, just create it and then ignore a "file
exists" error.
@dansimau dansimau changed the title Add TravisCI, linter, commit hooks Add Travis, linter, commit hooks and fix races Dec 28, 2018

@btromanova btromanova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not related to this diff, but I've noticed that help for tvm command doesn't tell you to specify the version you want to get. Maybe you can fix it in this PR as well. If not, I can create a separate issue for that:

tr-C02Q34JGG8WM:astro tatianaromanova$ tvm install --help
Download and link the specified version of Terraform

Usage:
  tvm install [flags]

Flags:
  -h, --help          help for install
      --path string   path to link Terraform binary to (default: /usr/local/bin/terraform )

Global Flags:
      --repo string   path to store versions (default is $HOME/.tvm)

Comment thread Makefile Resolved
Comment thread .travis.yml Resolved
@dansimau

Copy link
Copy Markdown
Contributor Author

@tr thanks, filed #18 for the help issue with tvm.

Comment thread astro/tvm/versionrepo.go Resolved
Comment thread astro/tvm/versionrepo.go Resolved
@dansimau
dansimau merged commit 58c412a into master Dec 28, 2018
@dansimau
dansimau deleted the add-travis-linter-hooks branch December 28, 2018 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition when executing terraform binary Tests fail on CI due to Terraform not being installed

3 participants