-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add terratest * Add alpine makefile
- Loading branch information
Showing
8 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.gopath | ||
vendor/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[constraint]] | ||
name = "github.com/stretchr/testify" | ||
version = "1.2.2" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
PACKAGE = terraform-null-label | ||
GOPATH = $(CURDIR)/.gopath | ||
GOBIN = $(GOPATH)/bin | ||
BASE = $(GOPATH)/src/$(PACKAGE) | ||
PATH := $(PATH):$(GOBIN) | ||
|
||
.PHONY: all | ||
## Default target | ||
all: test | ||
|
||
-include Makefile.* | ||
|
||
export GOPATH | ||
|
||
## Prepare the GOPATH | ||
$(BASE): | ||
@mkdir -p $(dir $@) | ||
@ln -sf $(CURDIR) $@ | ||
|
||
## install OS-specific dependencies. See Makefile.* | ||
deps:: | ||
@exit 0 | ||
|
||
.PHONY : init | ||
## Initialize tests | ||
init: | $(BASE) | ||
|
||
.PHONY : ensure | ||
## Install test dependencies | ||
ensure: | ||
cd $(BASE) && dep ensure | ||
|
||
.PHONY : test | ||
## Run tests | ||
test: deps ensure | ||
cd $(BASE) && go test -v -timeout 30m -run TestExamplesComplete | ||
|
||
## Clean up files | ||
clean: | ||
rm -rf .gopath/ vendor/ | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ifneq (,$(wildcard /sbin/apk)) | ||
.PHONY : deps | ||
deps:: | ||
mkdir -p $(GOBIN) | ||
apk add --update go | ||
@curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
endif | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// Test the Terraform module in examples/complete using Terratest. | ||
func TestExamplesComplete(t *testing.T) { | ||
t.Parallel() | ||
|
||
terraformOptions := &terraform.Options{ | ||
// The path to where our Terraform code is located | ||
TerraformDir: "../../examples/complete", | ||
} | ||
|
||
// At the end of the test, run `terraform destroy` to clean up any resources that were created | ||
defer terraform.Destroy(t, terraformOptions) | ||
|
||
// This will run `terraform init` and `terraform apply` and fail the test if there are any errors | ||
terraform.InitAndApply(t, terraformOptions) | ||
|
||
// Run `terraform output` to get the value of an output variable | ||
label1 := terraform.OutputMap(t, terraformOptions, "label1") | ||
|
||
// Verify we're getting back the outputs we expect | ||
assert.Equal(t, "winstonchurchroom-uat-build-fire-water-earth-air", label1["id"]) | ||
|
||
// Run `terraform output` to get the value of an output variable | ||
label2 := terraform.OutputMap(t, terraformOptions, "label2") | ||
|
||
// Verify we're getting back the outputs we expect | ||
assert.Equal(t, "charlie+uat+test+fire+water+earth+air", label2["id"]) | ||
|
||
// Run `terraform output` to get the value of an output variable | ||
label3 := terraform.OutputMap(t, terraformOptions, "label3") | ||
|
||
// Verify we're getting back the outputs we expect | ||
assert.Equal(t, "starfish.uat.release.fire.water.earth.air", label3["id"]) | ||
} |