Skip to content

terratests-fcr-prod-suite #13

terratests-fcr-prod-suite

terratests-fcr-prod-suite #13

name: terratests-fcr-prod-suite
on:
workflow_dispatch:
jobs:
setup-tests:
name: Setup PROD DIGP Tests
runs-on: ubuntu-latest
env:
TF_VAR_equinix_client_id: ${{ secrets.EQUINIX_CLIENT_ID }}
TF_VAR_equinix_client_secret: ${{ secrets.EQUINIX_CLIENT_SECRET }}
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}}
TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION}}
TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION: ${{secrets.TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION}}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
id: go
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Get dependencies
run: |
go mod download
go install github.com/thogarty/go-junit-report/v2@latest
pip3 install junit2html
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Install jq
run: |
sudo apt-get install jq
- name: Setup Variables Files
run: |
TIMESTAMP=$(date +"%m%d%M%S")
SUFFIX="_DIGP"
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"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/cloud-router-2-aws-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/cloud-router-2-aws-connection/tmp.test.json && mv ./tests/examples-without-external-providers/cloud-router-2-aws-connection/tmp.test.json ./tests/examples-without-external-providers/cloud-router-2-aws-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-azure-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/cloud-router-2-azure-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/cloud-router-2-azure-connection/tmp.test.json && mv ./tests/examples-without-external-providers/cloud-router-2-azure-connection/tmp.test.json ./tests/examples-without-external-providers/cloud-router-2-azure-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_PORT_ROUTING_PROTOCOL_CONNECTION >> "./tests/examples-without-external-providers/cloud-router-2-port-connection-with-routing-protocols-and-route-filters/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/tmp.test.json && mv ./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/tmp.test.json ./tests/examples-without-external-providers/cloud-router-2-port-routing-protocol-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_SERVICE_PROFILE_CONNECTION >> "./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json > ./examples/cloud-router-2-service-profile-connection/tmp.test.json && mv ./examples/cloud-router-2-service-profile-connection/tmp.test.json ./examples/cloud-router-2-service-profile-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_WAN_CONNECTION >> "./examples/cloud-router-2-wan-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-wan-connection/terraform.tfvars.json > ./examples/cloud-router-2-wan-connection/tmp.test.json && mv ./examples/cloud-router-2-wan-connection/tmp.test.json ./examples/cloud-router-2-wan-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_CLOUD_ROUTER_2_VIRTUAL_DEVICE_CONNECTION >> "./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json > ./examples/cloud-router-2-virtual-device-connection/tmp.test.json && mv ./examples/cloud-router-2-virtual-device-connection/tmp.test.json ./examples/cloud-router-2-virtual-device-connection/terraform.tfvars.json
- name: Run Go Tests
run:
go test ./tests/prod/cloud-router -json -v -count 1 -parallel 8 -run "(DIGP)" -timeout 180m | tee fcr_prod_suite.log
- name: Create HTML Testing Report
run: |
go-junit-report -parser gojson -in fcr_prod_suite.log > fcr_prod_suite.xml && python3 -m junit2htmlreport fcr_prod_suite.xml fcr_prod_suite.html
- name: Upload HTML Testing Report
uses: actions/upload-artifact@v4
with:
name: FCR Prod Suite Terraform Modules Testing Report
path: fcr_prod_suite.html
compression-level: 0