-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (76 loc) · 6.68 KB
/
terratests-port-prod-suite.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: terratests-port-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 }}
GOOGLE_SERVICE_KEYS: ${{ secrets.GOOGLE_SERVICE_KEYS }}
TEST_DATA_PROD_PORT_2_ALIBABA_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_ALIBABA_CONNECTION }}
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_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 }}
TEST_DATA_PROD_PORT_2_WAN_CONNECTION: ${{ secrets.TEST_DATA_PROD_PORT_2_WAN_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_PORT_2_ALIBABA_CONNECTION >> "./examples/port-2-alibaba-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/port-2-alibaba-connection/terraform.tfvars.json > ./examples/port-2-alibaba-connection/tmp.test.json && mv ./examples/port-2-alibaba-connection/tmp.test.json ./examples/port-2-alibaba-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_AWS_CONNECTION >> "./tests/examples-without-external-providers/port-2-aws-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/port-2-aws-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/port-2-aws-connection/tmp.test.json && mv ./tests/examples-without-external-providers/port-2-aws-connection/tmp.test.json ./tests/examples-without-external-providers/port-2-aws-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_AZURE_CONNECTION >> "./tests/examples-without-external-providers/port-2-azure-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/port-2-azure-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/port-2-azure-connection/tmp.test.json && mv ./tests/examples-without-external-providers/port-2-azure-connection/tmp.test.json ./tests/examples-without-external-providers/port-2-azure-connection/terraform.tfvars.json
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_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"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/port-2-port-connection/terraform.tfvars.json > ./examples/port-2-port-connection/tmp.test.json && mv ./examples/port-2-port-connection/tmp.test.json ./examples/port-2-port-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_PRIVATE_SERVICE_PROFILE_CONNECTION >> "./examples/port-2-private-service-profile-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./examples/port-2-private-service-profile-connection/terraform.tfvars.json > ./examples/port-2-private-service-profile-connection/tmp.test.json && mv ./examples/port-2-private-service-profile-connection/tmp.test.json ./examples/port-2-private-service-profile-connection/terraform.tfvars.json
echo $TEST_DATA_PROD_PORT_2_WAN_CONNECTION >> "./tests/examples-without-external-providers/port-2-wan-connection/terraform.tfvars.json"
jq --arg timestamp "$TIMESTAMP" '.connection_name = ($timestamp + "_" + .connection_name)' ./tests/examples-without-external-providers/port-2-wan-connection/terraform.tfvars.json > ./tests/examples-without-external-providers/port-2-wan-connection/tmp.test.json && mv ./tests/examples-without-external-providers/port-2-wan-connection/tmp.test.json ./tests/examples-without-external-providers/port-2-wan-connection/terraform.tfvars.json
- name: Run Go Tests
run:
go test ./tests/prod/port -v -json -count 1 -parallel 8 -run "(DIGP)" -timeout 180m | tee port_prod_suite.log
- name: Create HTML Testing Report
run: |
go-junit-report -parser gojson -in port_prod_suite.log > port_prod_suite.xml && python3 -m junit2htmlreport port_prod_suite.xml port_prod_suite.html
- name: Upload HTML Testing Report
uses: actions/upload-artifact@v4
with:
name: Port Prod Suite Terraform Modules Testing Report
path: port_prod_suite.html
compression-level: 0