Skip to content

Commit

Permalink
test: create unique names for resource groups integration tests (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmurray-lacework authored Dec 2, 2021
1 parent c2928b6 commit ed382b1
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
8 changes: 6 additions & 2 deletions integration/resource_lacework_resource_group_account_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,11 +15,13 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupLwAccountCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test LwAccount Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_account",
Vars: map[string]interface{}{
"description": "Terraform Test LwAccount Resource Group",
"lw_accounts": []string{"tech-ally"},
"resource_group_name": name,
"description": "Terraform Test LwAccount Resource Group",
"lw_accounts": []string{"tech-ally"},
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down
6 changes: 5 additions & 1 deletion integration/resource_lacework_resource_group_aws_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,10 +15,12 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupAwsCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test Aws Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_aws",
Vars: map[string]interface{}{
"description": "Terraform Test Aws Resource Group",
"resource_group_name": name,
"description": "Terraform Test Aws Resource Group",
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down
10 changes: 7 additions & 3 deletions integration/resource_lacework_resource_group_azure_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,12 +15,14 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupAzureCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test Azure Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_azure",
Vars: map[string]interface{}{
"description": "Terraform Test Azure Resource Group",
"tenant": "b21aa1ab-111a-11ab-a000-11aa1111a11a",
"subscriptions": []string{"1a1a0b2-abc0-1ab1-1abc-1a000ab0a0a0"},
"resource_group_name": name,
"description": "Terraform Test Azure Resource Group",
"tenant": "b21aa1ab-111a-11ab-a000-11aa1111a11a",
"subscriptions": []string{"1a1a0b2-abc0-1ab1-1abc-1a000ab0a0a0"},
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down
12 changes: 8 additions & 4 deletions integration/resource_lacework_resource_group_container_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,13 +15,15 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupContainerCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test Machine Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_container",
Vars: map[string]interface{}{
"description": "Terraform Test Container Resource Group",
"ctr_tags": []string{"test-tag"},
"ctr_key": "test-key",
"ctr_value": "test-value",
"resource_group_name": name,
"description": "Terraform Test Container Resource Group",
"ctr_tags": []string{"test-tag"},
"ctr_key": "test-key",
"ctr_value": "test-value",
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down
10 changes: 7 additions & 3 deletions integration/resource_lacework_resource_group_gcp_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,12 +15,14 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupGcpCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test LwAccount Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_gcp",
Vars: map[string]interface{}{
"description": "Terraform Test Gcp Resource Group",
"organization": "MyGcpOrg",
"projects": []string{"pro-123", "pro-321"},
"resource_group_name": name,
"description": "Terraform Test Gcp Resource Group",
"organization": "MyGcpOrg",
"projects": []string{"pro-123", "pro-321"},
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down
10 changes: 7 additions & 3 deletions integration/resource_lacework_resource_group_machine_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package integration

import (
"fmt"
"testing"
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
Expand All @@ -13,12 +15,14 @@ import (
// It uses the go-sdk to verify the created resource group,
// applies an update with new description and destroys it
func TestResourceGroupMachineCreate(t *testing.T) {
name := fmt.Sprintf("Terraform Test Machine Resource Group - %s", time.Now())
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../examples/resource_lacework_resource_group_machine",
Vars: map[string]interface{}{
"description": "Terraform Test Machine Resource Group",
"machine_key": "test-key",
"machine_value": "test-value",
"resource_group_name": name,
"description": "Terraform Test Machine Resource Group",
"machine_key": "test-key",
"machine_value": "test-value",
},
})
defer terraform.Destroy(t, terraformOptions)
Expand Down

0 comments on commit ed382b1

Please sign in to comment.