Skip to content

Commit

Permalink
Merge pull request #12 from confusdcodr/test_output
Browse files Browse the repository at this point in the history
Update testing harness
  • Loading branch information
confusdcodr authored Oct 3, 2019
2 parents 240c55e + 4d488c8 commit 0bc26bf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.0
current_version = 1.0.1
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### 1.0.1

**Released**: 2019.10.02

**Commit Delta**: [Change from 1.0.0 release](https://github.com/plus3it/terraform-aws-tardigrade-vpc-endpoints/compare/1.0.0...1.0.1)

**Summary**:

* Update testing harness to have a more user-friendly output
* Update terratest dependencies

### 1.0.0

**Released**: 2019.09.11
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Terraform module to create VPC Endpoints

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| create\_vpc\_endpoints | toggle to create vpc endpoints | string | `"true"` | no |
| create\_vpc\_endpoints | toggle to create vpc endpoints | bool | `"true"` | no |
| subnet\_ids | target subnet ids | list(string) | `<list>` | no |
| tags | A map of tags to add to the VPC endpoint SG | map(string) | `<map>` | no |
| vpc\_endpoint\_interfaces | List of aws api endpoints that are used to create VPC Interface endpoints. See https://docs.aws.amazon.com/general/latest/gr/rande.html for full list. | list(string) | `<list>` | no |
Expand Down
30 changes: 14 additions & 16 deletions tests/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,24 @@ func TestModule(t *testing.T) {
for _, f := range files {
// look for directories with test cases in it
if f.IsDir() && f.Name() != "vendor" {
investigateDirectory(t, f)
t.Run(f.Name(), func(t *testing.T) {
// check if a prereq directory exists
prereqDir := f.Name() + "/prereq/"
if _, err := os.Stat(prereqDir); err == nil {
prereqOptions := createTerraformOptions(prereqDir)
defer terraform.Destroy(t, prereqOptions)
terraform.InitAndApply(t, prereqOptions)
}

// run terraform code for test case
terraformOptions := createTerraformOptions(f.Name())
defer terraform.Destroy(t, terraformOptions)
terraform.InitAndApply(t, terraformOptions)
})
}
}
}

func investigateDirectory(t *testing.T, directory os.FileInfo) {
// check if a prereq directory exists
prereqDir := directory.Name() + "/prereq/"
if _, err := os.Stat(prereqDir); err == nil {
prereqOptions := createTerraformOptions(prereqDir)
defer terraform.Destroy(t, prereqOptions)
terraform.InitAndApply(t, prereqOptions)
}

// run terraform code for test case
terraformOptions := createTerraformOptions(directory.Name())
defer terraform.Destroy(t, terraformOptions)
terraform.InitAndApply(t, terraformOptions)
}

func createTerraformOptions(directory string) *terraform.Options {
terraformOptions := &terraform.Options{
TerraformDir: directory,
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "create_vpc_endpoints" {
type = string
description = "toggle to create vpc endpoints"
type = bool
default = true
}

Expand Down

0 comments on commit 0bc26bf

Please sign in to comment.