|
1 | 1 | // Managed By : CloudDrove |
2 | | -// Description : This Terratest is used to test the Terraform EFS module. |
| 2 | +// Description : This Terratest is used to test the Terraform EFS modules. |
3 | 3 | // Copyright @ CloudDrove. All Right Reserved. |
4 | | - |
5 | 4 | package test |
6 | 5 |
|
7 | 6 | import ( |
8 | 7 | "testing" |
9 | | - //"strings" |
10 | | - "github.com/stretchr/testify/assert" |
11 | 8 | "github.com/gruntwork-io/terratest/modules/terraform" |
| 9 | + "github.com/stretchr/testify/assert" |
12 | 10 | ) |
13 | 11 |
|
14 | | -func TestEFS(t *testing.T) { |
| 12 | +func Test(t *testing.T) { |
15 | 13 | t.Parallel() |
16 | 14 |
|
17 | 15 | terraformOptions := &terraform.Options{ |
18 | 16 | // Source path of Terraform directory. |
19 | 17 | TerraformDir: "../_example", |
20 | | - Upgrade: true, |
21 | 18 | } |
22 | 19 |
|
23 | | - // This will run `terraform init` and `terraform apply` and fail the test if there are any errors |
| 20 | + // This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur |
24 | 21 | terraform.InitAndApply(t, terraformOptions) |
25 | 22 |
|
26 | | - // At the end of the test, run `terraform destroy` to clean up any resources that were created |
| 23 | + // To clean up any resources that have been created, run 'terraform destroy' towards the end of the test |
27 | 24 | defer terraform.Destroy(t, terraformOptions) |
28 | 25 |
|
29 | | - // Run `terraform output` to get the value of an output variable |
30 | | - keyArn := terraform.Output(t, terraformOptions, "efs_arn") |
| 26 | + // To get the value of an output variable, run 'terraform output' |
| 27 | + Tags := terraform.OutputMap(t, terraformOptions, "tags") |
| 28 | + |
| 29 | + // Check that we get back the outputs that we expect |
| 30 | + assert.Equal(t, "efs-test", Tags["Name"]) |
31 | 31 |
|
32 | | - // Verify we're getting back the outputs we expect |
33 | | - assert.Contains(t, keyArn, "arn:aws:elasticfilesystem") |
34 | 32 | } |
0 commit comments