-
Notifications
You must be signed in to change notification settings - Fork 2
141 lines (121 loc) · 6.82 KB
/
cli-test-pipeline.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: CLI Test Pipeline
on: workflow_call
jobs:
test:
name: Run Generator tests
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Check out code
uses: actions/checkout@v4
- name: Set up Terraform latest
uses: hashicorp/setup-terraform@v2
- name: Setup Test broker
run: |
mkdir -p $HOME/solace; chmod 777 $HOME/solace
docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --env system_scaling_maxkafkabridgecount="10" --name=solace \
--env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:"10.9.1.115"
while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done
- name: Use local provider
run: |
echo "
provider_installation {
dev_overrides {
\"registry.terraform.io/solaceproducts/solacebroker\" = \"${HOME}/go/bin\"
}
direct {}
}" > ~/.terraformrc
- name: Build provider
run: |
make test-coverage
make install
ls ~/go/bin
terraform-provider-solacebroker -h
- name: Failure to Generate sample Terraform due to Missing Username for Broker
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 msgVpn solace_broker gha_test.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Failure to Generate sample Terraform due to Authentication wrong for Broker
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=wrongpassword terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Failure to Generate sample Terraform due to Password and Bearer Token Not Present
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Failure to Generate sample Terraform due to invalid provider specific identifiers
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default/msg_vpn gha_test.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Failure to Generate sample Terraform due to invalid provider specific identifiers2
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_rest_delivery_point.my-rdp default messageVpn.tf || error_code=$?
if [ $error_code -eq 1 ]; then
echo "\nExpected failure accurate"
exit 0
fi
exit 1
- name: Generate sample Terraform for message vpn
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.default default messageVpn.tf
cat messageVpn.tf
- name: Test generated terraform on broker
run: |
# Create
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin terraform plan
TF_VAR_broker_url=http://localhost:8080 TF_VAR_broker_username=admin TF_VAR_broker_password=admin terraform apply -auto-approve
sleep 1
- name: Create custom messageVPN with 22 messageVpn queues (Paging Test)
run: |
pushd ci/broker_vpn_q3
# Create
terraform plan
terraform apply -auto-approve
sleep 1
popd
- name: Confirm all 22 queues are present with paging (Paging Test)
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.qn another messageVpn.tf
cat messageVpn.tf
grep -o 'solacebroker_msg_vpn_queue" ' messageVpn.tf | wc -l | grep 22
- name: Test escape characters in resources
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_queue_subscription.test another/aperfectly%2F%24%2Fvalid%2F%24topic%2F%24%24/foo%2Fbarr messageVpn.tf
cat messageVpn.tf
- name: Create custom messageVPN with large config
run: |
pushd ci/bigtest
# Create
terraform plan
terraform apply -auto-approve
sleep 1
popd
- name: Generate complete large config file for custom messageVPN file
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn.test test messageVpn.tf
cat messageVpn.tf
# also confirm comment is generated when ancillary object is referenced
cat messageVpn.tf | grep depends_on
- name: Generate some resources( only msg_vpn_queue) for custom messageVPN file
run: |
SOLACEBROKER_REGISTRY_OVERRIDE=registry.terraform.io/solaceproducts/solacebroker SOLACEBROKER_USERNAME=admin SOLACEBROKER_PASSWORD=admin terraform-provider-solacebroker generate --url=http://localhost:8080 solacebroker_msg_vpn_queue.q test/test messageVpn.tf
cat messageVpn.tf