From b99d992ba190b8b22e50988d59c27fa33e8f34bd Mon Sep 17 00:00:00 2001 From: jkallem Date: Fri, 9 Aug 2024 10:50:29 -0700 Subject: [PATCH] Update the GHA Path to fix Run Tests Separately --- .../workflows/terratests-fcr-prod-suite.yaml | 2 +- .../workflows/terratests-port-prod-suite.yaml | 2 +- .../terratests-virtualdevice-prod-suite.yaml | 2 +- .../prod/cloud-router/prod_sanity_fcr_test.go | 117 ++++++++++++ tests/prod/port/prod_sanity_port_test.go | 167 ++++++++++++++++++ .../virtual-device/prod_sanity_vd_test.go | 58 ++++++ 6 files changed, 345 insertions(+), 3 deletions(-) create mode 100644 tests/prod/cloud-router/prod_sanity_fcr_test.go create mode 100644 tests/prod/port/prod_sanity_port_test.go create mode 100644 tests/prod/virtual-device/prod_sanity_vd_test.go diff --git a/.github/workflows/terratests-fcr-prod-suite.yaml b/.github/workflows/terratests-fcr-prod-suite.yaml index e6d1b722..7a1e9ee3 100644 --- a/.github/workflows/terratests-fcr-prod-suite.yaml +++ b/.github/workflows/terratests-fcr-prod-suite.yaml @@ -61,7 +61,7 @@ jobs: - name: Run Go Tests run: - go test ./tests/prod -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m + go test ./tests/prod/cloud-router -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m - name: Upload test coverage to Codecov if: ${{ always() }} diff --git a/.github/workflows/terratests-port-prod-suite.yaml b/.github/workflows/terratests-port-prod-suite.yaml index 12d55132..488962d3 100644 --- a/.github/workflows/terratests-port-prod-suite.yaml +++ b/.github/workflows/terratests-port-prod-suite.yaml @@ -70,7 +70,7 @@ jobs: - name: Run Go Tests run: - go test ./tests/prod -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m + go test ./tests/prod/port -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m - name: Upload test coverage to Codecov if: ${{ always() }} diff --git a/.github/workflows/terratests-virtualdevice-prod-suite.yaml b/.github/workflows/terratests-virtualdevice-prod-suite.yaml index 908937a4..85e676a0 100644 --- a/.github/workflows/terratests-virtualdevice-prod-suite.yaml +++ b/.github/workflows/terratests-virtualdevice-prod-suite.yaml @@ -52,7 +52,7 @@ jobs: - name: Run Go Tests run: - go test ./tests/prod -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m + go test ./tests/prod/virtual-device -v -coverprofile coverage_prod_modules.txt -covermode=atomic -count 1 -parallel 8 -run "(DIGP)" -timeout 180m - name: Upload test coverage to Codecov if: ${{ always() }} diff --git a/tests/prod/cloud-router/prod_sanity_fcr_test.go b/tests/prod/cloud-router/prod_sanity_fcr_test.go new file mode 100644 index 00000000..fa334cc8 --- /dev/null +++ b/tests/prod/cloud-router/prod_sanity_fcr_test.go @@ -0,0 +1,117 @@ +package prod + +import ( + "github.com/gruntwork-io/terratest/modules/terraform" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestCloudRouterCreate_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "cloud_router_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "fcr_name": "FCR_Name_Update", + }, + TerraformDir: "../../tests/examples-without-external-providers/cloud-router", + }) + terraform.Apply(t, terraformOptions) +} + +func TestCloudRouter2AwsCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-aws-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "aws_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2AzureCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-azure-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "azure_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2PortRoutingProtocolCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "port_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "FCR2Port_Name_Update", + "bandwidth": 100, + }, + TerraformDir: "../../tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection", + }) + terraform.Apply(t, terraformOptions) +} + +func TestCloudRouter2ServiceProfileCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/cloud-router-2-service-profile-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "service_profile_connection_id") + assert.NotNil(t, output) +} + +func TestCloudRouter2WanCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/cloud-router-2-wan-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "wan_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "FCR2WAN_Name_Update", + "bandwidth": 50, + }, + TerraformDir: "../../examples/cloud-router-2-wan-connection", + }) + terraform.Apply(t, terraformOptions) +} diff --git a/tests/prod/port/prod_sanity_port_test.go b/tests/prod/port/prod_sanity_port_test.go new file mode 100644 index 00000000..7d412d0f --- /dev/null +++ b/tests/prod/port/prod_sanity_port_test.go @@ -0,0 +1,167 @@ +package prod + +import ( + "github.com/gruntwork-io/terratest/modules/terraform" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestPort2AlibabaCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-alibaba-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "alibaba_connection_id") + assert.NotNil(t, output) +} + +func TestPort2AwsCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/port-2-aws-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "aws_connection_id") + assert.NotNil(t, output) +} + +func TestPort2AzureCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/port-2-azure-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "azure_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "P2Azure_Name_Update", + }, + TerraformDir: "../../tests/examples-without-external-providers/port-2-azure-connection", + }) + terraform.Apply(t, terraformOptions) +} + +func TestPort2GoogleCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-google-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "google_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "bandwidth": 100, + }, + TerraformDir: "../../examples/port-2-google-connection", + }) + terraform.Apply(t, terraformOptions) +} + +func TestPort2Ibm2CreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-ibm2-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "ibm2_connection_id") + assert.NotNil(t, output) +} + +func TestPort2OracleCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-oracle-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "oracle_connection_id") + assert.NotNil(t, output) +} + +func TestPort2PortCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-port-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "port_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "P2Port_Name_Update", + "bandwidth": 100, + }, + TerraformDir: "../../examples/port-2-port-connection", + }) + terraform.Apply(t, terraformOptions) +} + +func TestPort2PrivateServiceProfileCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../examples/port-2-private-service-profile-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "private_sp_connection_id") + assert.NotNil(t, output) +} + +func TestPort2WanCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/port-2-wan-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "wan_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "P2WAN_Name_Update", + "bandwidth": 50, + }, + TerraformDir: "../../tests/examples-without-external-providers/port-2-wan-connection", + }) + terraform.Apply(t, terraformOptions) +} diff --git a/tests/prod/virtual-device/prod_sanity_vd_test.go b/tests/prod/virtual-device/prod_sanity_vd_test.go new file mode 100644 index 00000000..55b70fb2 --- /dev/null +++ b/tests/prod/virtual-device/prod_sanity_vd_test.go @@ -0,0 +1,58 @@ +package prod + +import ( + "github.com/gruntwork-io/terratest/modules/terraform" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestVirtualDevice2WanCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/virtual-device-2-wan-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "wan_connection_id") + assert.NotNil(t, output) +} + +func TestVirtualDevice2AzureCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/virtual-device-2-azure-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "azure_connection_id") + assert.NotNil(t, output) +} + +func TestVirtualDevice2PortCreateConnection_DIGP(t *testing.T) { + + terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + TerraformDir: "../../tests/examples-without-external-providers/virtual-device-2-port-connection", + }) + + defer terraform.Destroy(t, terraformOptions) + t.Parallel() + + terraform.InitAndApply(t, terraformOptions) + output := terraform.Output(t, terraformOptions, "port_connection_id") + assert.NotNil(t, output) + + terraformOptions = terraform.WithDefaultRetryableErrors(t, &terraform.Options{ + Vars: map[string]interface{}{ + "connection_name": "VD2Port_Name_Update", + "bandwidth": 10, + }, + TerraformDir: "../../tests/examples-without-external-providers/virtual-device-2-port-connection", + }) + terraform.Apply(t, terraformOptions) +}