Skip to content

Commit

Permalink
gha_fix:Update the GHA Path to fix Run Tests Separately (#113)
Browse files Browse the repository at this point in the history
* Update the GHA Path to fix Run Tests Separately

* Update the GHA Path to fix Run Tests Separately

* fixed GHA path for test file pick in GO.

* Removed IBM relates Tests from GHA due to Test Failures from IBM end

* Removed IBM relates Tests from GHA due to Test Failures from IBM end

* fix: changing status of Metal 2 Azure connection

* fix: Updating Terra test for port 2 WAN connection

---------

Co-authored-by: srushti-patl <[email protected]>
  • Loading branch information
jkallem-equinix and srushti-patl authored Aug 10, 2024
1 parent 60c8a6e commit e13b8d0
Show file tree
Hide file tree
Showing 10 changed files with 334 additions and 36 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/terratests-fcr-prod-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
env:
TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID }}
TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET }}
GOOGLE_SERVICE_KEYS: ${{ secrets.GOOGLE_SERVICE_KEYS }}
TEST_DATA_PROD_CLOUD_ROUTER: ${{ secrets.TEST_DATA_PROD_CLOUD_ROUTER }}
TEST_DATA_PROD_CLOUD_ROUTER_2_AWS_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_AWS_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_AZURE_CONNECTION}}
Expand Down Expand Up @@ -45,7 +44,6 @@ jobs:
run: |
TIMESTAMP=$(date +"%m%d%M%S")
SUFFIX="_DIGP"
echo $GOOGLE_SERVICE_KEYS >> "./examples/port-2-google-connection/keys.json"
echo $TEST_DATA_PROD_CLOUD_ROUTER >> "./tests/examples-without-external-providers/cloud-router/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/cloud-router/terraform.tfvars.json > ./tests/examples-without-external-providers/cloud-router/tmp.test.json && mv ./tests/examples-without-external-providers/cloud-router/tmp.test.json ./tests/examples-without-external-providers/cloud-router/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-aws-connection/terraform.tfvars.json"
Expand All @@ -61,7 +59,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() }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/terratests-metal-nimf-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
TEST_DATA_PROD_METAL_NIMF_2_ORACLE_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_ORACLE_CONNECTION }}
TEST_DATA_PROD_CLOUD_ROUTER_2_METAL_NIMF_CONNECTION: ${{ secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_METAL_NIMF_CONNECTION }}
TEST_DATA_PROD_METAL_NIMF_2_PORT_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_PORT_CONNECTION }}
TEST_DATA_PROD_METAL_NIMF_2_IBM2_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_IBM2_CONNECTION }}
TEST_DATA_PROD_METAL_NIMF_2_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_SERVICE_PROFILE_CONNECTION }}
TEST_DATA_PROD_METAL_NIMF_2_GOOGLE_CONNECTION: ${{ secrets.TEST_DATA_PROD_METAL_NIMF_2_GOOGLE_CONNECTION }}

Expand Down Expand Up @@ -61,8 +60,6 @@ jobs:
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-metal-nimf-connection/terraform.tfvars.json > ./examples/cloud-router-2-metal-nimf-connection/tmp.test.json && mv ./examples/cloud-router-2-metal-nimf-connection/tmp.test.json ./examples/cloud-router-2-metal-nimf-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_METAL_NIMF_2_PORT_CONNECTION >> "./examples/metal-nimf-2-port-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/metal-nimf-2-port-connection/terraform.tfvars.json > ./examples/metal-nimf-2-port-connection/tmp.test.json && mv ./examples/metal-nimf-2-port-connection/tmp.test.json ./examples/metal-nimf-2-port-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_METAL_NIMF_2_IBM2_CONNECTION >> "./examples/metal-nimf-2-ibm2-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP$SUFFIX" '.connection_name += "" + $timestamp' ./examples/metal-nimf-2-ibm2-connection/terraform.tfvars.json > ./examples/metal-nimf-2-ibm2-connection/tmp.test.json && mv ./examples/metal-nimf-2-ibm2-connection/tmp.test.json ./examples/metal-nimf-2-ibm2-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_METAL_NIMF_2_SERVICE_PROFILE_CONNECTION >> "./examples/metal-nimf-2-service-profile-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/metal-nimf-2-service-profile-connection/terraform.tfvars.json > ./examples/metal-nimf-2-service-profile-connection/tmp.test.json && mv ./examples/metal-nimf-2-service-profile-connection/tmp.test.json ./examples/metal-nimf-2-service-profile-connection/terraform.tfvars.json
echo $GOOGLE_SERVICE_KEYS >> "./examples/metal-nimf-2-google-connection/keys.json"
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/terratests-port-prod-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
TEST_DATA_PROD_PORT_2_AWS_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_AWS_CONNECTION }}
TEST_DATA_PROD_PORT_2_AZURE_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_AZURE_CONNECTION }}
TEST_DATA_PROD_PORT_2_GOOGLE_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_GOOGLE_CONNECTION }}
TEST_DATA_PROD_PORT_2_IBM2_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_IBM2_CONNECTION }}
TEST_DATA_PROD_PORT_2_ORACLE_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_ORACLE_CONNECTION }}
TEST_DATA_PROD_PORT_2_PORT_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_PORT_CONNECTION }}
TEST_DATA_PROD_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION }}
Expand Down Expand Up @@ -57,8 +56,6 @@ jobs:
echo $GOOGLE_SERVICE_KEYS >> "./examples/port-2-google-connection/keys.json"
echo $TEST_DATA_PROD_PORT_2_GOOGLE_CONNECTION >> "./examples/port-2-google-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/port-2-google-connection/terraform.tfvars.json > ./examples/port-2-google-connection/tmp.test.json && mv ./examples/port-2-google-connection/tmp.test.json ./examples/port-2-google-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_IBM2_CONNECTION >> "./examples/port-2-ibm2-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP$SUFFIX" '.connection_name += "" + $timestamp' ./examples/port-2-ibm2-connection/terraform.tfvars.json > ./examples/port-2-ibm2-connection/tmp.test.json && mv ./examples/port-2-ibm2-connection/tmp.test.json ./examples/port-2-ibm2-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_ORACLE_CONNECTION >> "./examples/port-2-oracle-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/port-2-oracle-connection/terraform.tfvars.json > ./examples/port-2-oracle-connection/tmp.test.json && mv ./examples/port-2-oracle-connection/tmp.test.json ./examples/port-2-oracle-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_PORT_CONNECTION >> "./examples/port-2-port-connection/terraform.tfvars.json"
Expand All @@ -70,7 +67,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() }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/terratests-virtualdevice-prod-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
env:
TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID }}
TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET }}
GOOGLE_SERVICE_KEYS: ${{ secrets.GOOGLE_SERVICE_KEYS }}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_WAN_CONNECTION: ${{ secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_WAN_CONNECTION }}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION}}
TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION: ${{secrets.TEST_DATA_PROD_VIRTUAL_DEVICE_2_PORT_CONNECTION}}
Expand Down Expand Up @@ -42,7 +41,6 @@ jobs:
run: |
TIMESTAMP=$(date +"%m%d%M%S")
SUFFIX="_DIGP"
echo $GOOGLE_SERVICE_KEYS >> "./examples/port-2-google-connection/keys.json"
echo $TEST_DATA_PROD_VIRTUAL_DEVICE_2_WAN_CONNECTION >> "./tests/examples-without-external-providers/virtual-device-2-wan-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/virtual-device-2-wan-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/virtual-device-2-wan-connection/tmp.test.json && mv ./tests/examples-without-external-providers/virtual-device-2-wan-connection/tmp.test.json ./tests/examples-without-external-providers/virtual-device-2-wan-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_VIRTUAL_DEVICE_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/virtual-device-2-azure-connection/terraform.tfvars.json"
Expand All @@ -52,7 +50,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() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ bandwidth = 50
project_id = "<Fabric_Project_ID>"
aside_fcr_uuid = "<Primary Fabric Cloud router UUID>"
zside_ap_type = "METAL_NETWORK"
direct_rp_name = "metal-conn-rp"
direct_equinix_ipv4_ip = "192.168.100.1/30"
4 changes: 0 additions & 4 deletions examples/metal-nimf-2-service-profile-connection/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ variable "zside_fabric_sp_name" {
description = "Equinix Service Profile Name"
type = string
}
variable "zside_seller_region" {
description = "Access point seller region"
type = string
}
variable "zside_location" {
description = "Access point metro code"
type = string
Expand Down
117 changes: 117 additions & 0 deletions tests/prod/cloud-router/prod_sanity_fcr_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
20 changes: 1 addition & 19 deletions tests/prod/metal-nimf/prod_metal_nimf_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestMetalNIMF2AzureCreateConnection(t *testing.T) {

assert.NotNil(t, outputConnectionId)
assert.NotNil(t, outputStatus)
assert.Equal(t, "active", outputStatus)
assert.Equal(t, "pending", outputStatus)
}

func TestMetalNIMF2GoogleCreateConnection(t *testing.T) {
Expand All @@ -60,24 +60,6 @@ func TestMetalNIMF2GoogleCreateConnection(t *testing.T) {
assert.Equal(t, "active", outputStatus)
}

func TestMetalNIMF2Ibm2CreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../../examples/metal-nimf-2-ibm2-connection",
})

defer terraform.Destroy(t, terraformOptions)
t.Parallel()

terraform.InitAndApply(t, terraformOptions)
outputConnectionId := terraform.Output(t, terraformOptions, "Metal_IBM2_Connection_Id")
outputStatus := terraform.Output(t, terraformOptions, "metal_connection_status")

assert.NotNil(t, outputConnectionId)
assert.NotNil(t, outputStatus)
assert.Equal(t, "active", outputStatus)
}

func TestMetalNIMF2OracleCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
Expand Down
Loading

0 comments on commit e13b8d0

Please sign in to comment.