Last active
March 7, 2018 00:13
-
-
Save YakDriver/e49945e52e80c89e7670de7da350a31e to your computer and use it in GitHub Desktop.
Running acceptance tests for Terraform Providers in go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hashicorp documentation is a bit out of date so it took a minute to figure this out... | |
# 1. Install go | |
https://golang.org/dl/ | |
# 2. Make a go workspace | |
$ mkdir ~/go # or wherever you want | |
$ export GOPATH=~/go # could add to .bash_profile | |
$ export PATH=$GOPATH:$PATH | |
# 3. Clone/build terraform | |
$ cd $GOPATH | |
$ mkdir -p src/github.com/hashicorp | |
$ cd src/github.com/hashicorp/ | |
$ git clone https://github.com/hashicorp/terraform.git | |
$ cd terraform/ | |
$ make | |
# 4. Fork/code | |
fork the main repository for your provider (e.g., https://github.com/terraform-providers/terraform-provider-aws.git) | |
make your changes, add your acceptance test | |
# 5. Clone YOUR terraform-providers (separate git) | |
$ mkdir -p $GOPATH/src/github.com/terraform-providers | |
$ cd $GOPATH/src/github.com/terraform-providers | |
$ git clone https://github.com/<YOUR-REPO>/terraform-provider-aws.git | |
# 6. Run acceptance test | |
$ make testacc TEST=github.com/terraform-providers/terraform-provider-aws/aws TESTARGS='-run=TestAccAWSSpotInstanceRequest_withoutSpotPrice' | |
# 7. Successful output looks like... | |
==> Checking that code complies with gofmt requirements... | |
go generate ./... | |
2018/03/06 18:36:08 Generated command/internal_plugin_list.go | |
TF_ACC=1 go test github.com/terraform-providers/terraform-provider-aws/aws -v -run=TestAccAWSSpotInstanceRequest_withoutSpotPrice -timeout 120m | |
=== RUN TestAccAWSSpotInstanceRequest_withoutSpotPrice | |
--- PASS: TestAccAWSSpotInstanceRequest_withoutSpotPrice (85.06s) | |
PASS | |
ok github.com/terraform-providers/terraform-provider-aws/aws 85.111s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment