Skip to content

Commit

Permalink
fix:updating uat terra tests workflow with env client_id & client_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
srushti-patl committed Apr 4, 2024
1 parent 29002b7 commit 6b9e316
Show file tree
Hide file tree
Showing 22 changed files with 169 additions and 18 deletions.
75 changes: 62 additions & 13 deletions .github/workflows/terratests-uat-suite.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,66 @@
name: terratests-uat-suite
name: terratests-examples-without-external-providers-suite

on:
pull_request:
workflow_dispatch:

jobs:
setup-tests:
test-PNFV:
name: Setup UAT Tests
runs-on: ubuntu-latest
env:
TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID_PNFV }}
TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET_PNFV }}
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com"
TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION }}

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
id: go

- name: Get dependencies
run: |
go mod download
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false

- name: Setup Variables Files
run: |
echo $TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION >> "./examples/port-2-alibaba-connection/terraform.tfvars.json"
- name: Run Go Tests
run:
go test ./tests/uat -v -coverprofile coverage_uat_modules.txt -covermode=atomic -count 1 -parallel 8 -timeout 180m

- name: Setup Node.js 20.11.1
uses: actions/setup-node@v2
with:
node-version: 20.11.1

- name: Upload test coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_uat_modules.txt

test-PFCR:
name: Setup UAT Tests
runs-on: ubuntu-latest
env:
TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID_PFCR }}
TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET_PFCR }}
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com"
TEST_DATA_UAT_PORT_2_AWS_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_AWS_CONNECTION }}
TEST_DATA_UAT_PORT_2_AZURE_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_AZURE_CONNECTION }}
TEST_DATA_UAT_PORT_2_IBM2_CONNECTION: ${{ secrets.TEST_DATA_UAT_PORT_2_IBM2_CONNECTION }}
Expand All @@ -37,25 +87,24 @@ jobs:

- name: Get dependencies
run: |
go mod download
go mod download
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false

- name: Setup Variables Files
run: |
echo $TEST_DATA_UAT_PORT_2_ALIBABA_CONNECTION >> "./examples/port-2-alibaba-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_AWS_CONNECTION >> "./tests/uat/port-2-aws-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_AZURE_CONNECTION >> "./tests/uat/port-2-azure-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/port-2-aws-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/port-2-azure-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_IBM2_CONNECTION >> "./examples/port-2-ibm2-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_PORT_CONNECTION >> "./examples/port-2-port-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION >> "./examples/port-2-private-service-profile-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION >> "./examples/port-2-public-service-profile-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AWS_CONNECTION >> "./tests/uat/cloud-router-2-aws-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AZURE_CONNECTION >> "./tests/uat/cloud-router-2-azure-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION >> "./tests/uat/cloud-router-2-port-routing-protocol-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-aws-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-azure-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION >> "./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json"
echo $TEST_DATA_UAT_CLOUD_ROUTER_2_WAN_CONNECTION >> "./examples/cloud-router-2-wan-connection/terraform.tfvars.json"
Expand All @@ -66,11 +115,11 @@ jobs:
- name: Setup Node.js 20.11.1
uses: actions/setup-node@v2
with:
node-version: 20.11.1
node-version: 20.11.1

- name: Upload test coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_uat_modules.txt
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage_uat_modules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
variable "equinix_client_id" {
description = "Equinix client ID (consumer key), obtained after registering app in the developer platform"
type = string
sensitive = true
}
variable "equinix_client_secret" {
description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform"
type = string
sensitive = true
}
variable "connection_name" {
description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores"
type = string
}
variable "connection_type" {
description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC"
default = ""
type = string
}
variable "notifications_type" {
description = "Notification Type - ALL is the only type currently supported"
type = string
default = "ALL"
}
variable "notifications_emails" {
description = "Array of contact emails"
type = list(string)
}
variable "bandwidth" {
description = "Connection bandwidth in Mbps"
type = number
}
variable "purchase_order_number" {
description = "Purchase order number"
type = string
default = ""
}
variable "aside_ap_type" {
description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW"
type = string
}
variable "aside_fcr_uuid" {
description = "Equinix-assigned Fabric Cloud Router identifier"
type = string
}
variable "zside_ap_authentication_key" {
description = "Authentication key for provider based connections"
type = string
sensitive = true
}
variable "zside_ap_type" {
description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW"
type = string
default = "SP"
}
variable "zside_ap_profile_type" {
description = "Service profile type - L2_PROFILE, L3_PROFILE, ECIA_PROFILE, ECMC_PROFILE"
type = string
default = "L2_PROFILE"
}
variable "zside_location" {
description = "Access point metro code"
type = string
default = "SP"
}
variable "zside_fabric_sp_name" {
description = "Equinix Service Profile Name"
type = string
default = ""
}
variable "zside_seller_region" {
description = "Access point seller region"
type = string
default = ""
}
variable "additional_info" {
description = "Additional parameters required for some service profiles. It should be a list of maps containing 'key' and 'value e.g. `[{ key='asn' value = '65000'}, { key='ip' value = '192.168.0.1'}]`"
type = list(object({ key = string, value = string }))
default = []
sensitive = true
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.5.4"
required_providers {
equinix = {
source = "equinix/equinix"
version = ">= 1.20.0"
}
}
}
File renamed without changes.
22 changes: 17 additions & 5 deletions tests/uat/uat_sanity_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func TestPort2AlibabaCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "alibaba_connection_id")
Expand All @@ -22,10 +23,11 @@ func TestPort2AlibabaCreateConnection(t *testing.T) {
func TestPort2AwsCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/uat/port-2-aws-connection",
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")
Expand All @@ -35,10 +37,11 @@ func TestPort2AwsCreateConnection(t *testing.T) {
func TestPort2AzureCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/uat/port-2-azure-connection",
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")
Expand All @@ -52,6 +55,7 @@ func TestPort2Ibm2CreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "ibm2_connection_id")
Expand All @@ -65,6 +69,7 @@ func TestPort2PortCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "port_connection_id")
Expand All @@ -78,6 +83,7 @@ func TestPort2PrivateServiceProfileCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "private_sp_connection_id")
Expand All @@ -91,6 +97,7 @@ func TestPort2PublicServiceProfileCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "public_sp_connection_id")
Expand All @@ -100,10 +107,11 @@ func TestPort2PublicServiceProfileCreateConnection(t *testing.T) {
func TestCloudRouter2AwsCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/uat/cloud-router-2-aws-connection",
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")
Expand All @@ -113,10 +121,11 @@ func TestCloudRouter2AwsCreateConnection(t *testing.T) {
func TestCloudRouter2AzureCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/uat/cloud-router-2-azure-connection",
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")
Expand All @@ -126,10 +135,11 @@ func TestCloudRouter2AzureCreateConnection(t *testing.T) {
func TestCloudRouter2PortRoutingProtocolCreateConnection(t *testing.T) {

terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "../../tests/uat/cloud-router-2-port-routing-protocol-connection",
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")
Expand All @@ -143,6 +153,7 @@ func TestCloudRouter2ServiceProfileCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "service_profile_connection_id")
Expand All @@ -156,6 +167,7 @@ func TestCloudRouter2WanCreateConnection(t *testing.T) {
})

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

terraform.InitAndApply(t, terraformOptions)
output := terraform.Output(t, terraformOptions, "wan_connection_id")
Expand Down

0 comments on commit 6b9e316

Please sign in to comment.