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

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

Merged
merged 13 commits into from
Dec 28, 2018

Conversation

dansimau
Copy link
Contributor

@dansimau dansimau commented Dec 27, 2018

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
Copy link
Contributor

@btromanova btromanova left a comment

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)

Makefile Show resolved Hide resolved
.travis.yml Show resolved Hide resolved
@dansimau
Copy link
Contributor Author

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

astro/tvm/versionrepo.go Outdated Show resolved Hide 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