Skip to content

Commit 5af778f

Browse files
Merge pull request #302 from stackql/dev
vpc-live-testing
2 parents 1e6167f + 4fe2b84 commit 5af778f

11 files changed

+339
-55
lines changed

.github/workflows/regression.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,12 @@ jobs:
241241
if: success()
242242
id: live_integration_tests_readonly
243243
env:
244-
GOOGLE_CREDENTIALS: ${{ secrets.CI_SCENARIO_GCP_RO_SECRET }}
244+
GOOGLE_CREDENTIALS: ${{ secrets.CI_ROBOT_GCP_RO_SECRET }}
245245
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RO_AWS_ACCESS_KEY_ID }}
246246
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RO_AWS_SECRET_ACCESS_KEY }}
247247
run: |
248248
providerRoot="$(realpath $(pwd)/providers)"
249-
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'", "GCS_BUCKET_NAME": "stackql-demo-bucket-02", "GCP_PROJECT": "stackql-demo", "AWS_RECORD_SET_ID": "A00000001AAAAAAAAAAAA", "AWS_RECORD_SET_REGION": "us-east-1"}'
249+
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'", "GCS_BUCKET_NAME": "stackql-robot-bucket-02", "GCP_PROJECT": "stackql-robot", "AWS_RECORD_SET_ID": "A00000001AAAAAAAAAAAA", "AWS_RECORD_SET_REGION": "us-east-1"}'
250250
robot \
251251
--variable "${sundryCfg}" \
252252
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \
@@ -270,12 +270,12 @@ jobs:
270270
if: github.ref_type == 'tag'
271271
id: live_integration_tests_readwrite
272272
env:
273-
GOOGLE_CREDENTIALS: ${{ secrets.CI_SCENARIO_GCP_RW_SECRET }}
273+
GOOGLE_CREDENTIALS: ${{ secrets.CI_ROBOT_GCP_RW_SECRET }}
274274
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RW_AWS_ACCESS_KEY_ID }}
275275
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RW_AWS_SECRET_ACCESS_KEY }}
276276
run: |
277277
providerRoot="$(realpath $(pwd)/providers)"
278-
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'", "GCS_BUCKET_NAME": "stackql-demo-bucket-02", "GCP_PROJECT": "stackql-demo", "AWS_RECORD_SET_ID": "A00000001AAAAAAAAAAAA", "AWS_RECORD_SET_REGION": "us-east-1"}'
278+
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'", "GCS_BUCKET_NAME": "stackql-robot-bucket-02", "GCP_PROJECT": "stackql-robot", "AWS_RECORD_SET_ID": "A00000001AAAAAAAAAAAA", "AWS_RECORD_SET_REGION": "us-east-1"}'
279279
robot \
280280
--variable "${sundryCfg}" \
281281
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ stackql-zip
99
stackql-core/
1010
stackql-any-sdk/
1111
.venv/
12+
*.py[co]
Binary file not shown.

test/robot/stackql/live/readonly/readonly_variables.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def _get_expected_gcs_bucket_check(
2020
Expected GCS bucket check.
2121
"""
2222
return '' + \
23-
'|------------------------|----------------|----------------|\n' + \
24-
'| name | softDeleteTime | hardDeleteTime |\n' + \
25-
'|------------------------|----------------|----------------|\n' + \
26-
'| stackql-demo-bucket-01 | null | null |\n' + \
27-
'|------------------------|----------------|----------------|'
23+
'|-------------------------|----------------|----------------|\n' + \
24+
'| name | softDeleteTime | hardDeleteTime |\n' + \
25+
'|-------------------------|----------------|----------------|\n' + \
26+
'| stackql-robot-bucket-01 | null | null |\n' + \
27+
'|-------------------------|----------------|----------------|'
2828

2929

3030
def get_variables(

test/robot/stackql/live/readonly/stackql.resource

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ ${USE_STACKQL_PREINSTALLED} false # to be overridden from command l
1111
${CORE_PREFIX} stackql-core
1212
${SUNDRY_CONFIG}= SEPARATOR=
1313
... {
14-
... "GCS_BUCKET_NAME": "stackql-demo-bucket-01",
15-
... "GCP_PROJECT": "stackql-demo",
14+
... "GCS_BUCKET_NAME": "stackql-robot-bucket-01",
15+
... "GCP_PROJECT": "stackql-robot",
1616
... "AWS_RECORD_SET_ID": "A00000001AAAAAAAAAAAA",
1717
... "AWS_RECORD_SET_REGION": "us-east-1",
1818
... "registry_path": "${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}providers"
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
2+
3+
4+
5+
```sql
6+
7+
--
8+
insert into google.compute.networks(data__name, data__autoCreateSubnetworks, project)
9+
select 'robot-vpc-01', false, 'stackql-robot';
10+
The operation was despatched successfully
11+
12+
--
13+
select id, name, description, subnetworks from google.compute.networks where name = 'robot-vpc-01' and project = 'stackql-robot';
14+
|--------------------|--------------|-------------|-------------|
15+
| id | name | description | subnetworks |
16+
|--------------------|--------------|-------------|-------------|
17+
| 987158103920671616 | robot-vpc-01 | null | null |
18+
|--------------------|--------------|-------------|-------------|
19+
20+
--
21+
insert into google.compute.subnetworks(data__name, data__ipCidrRange, data__description, data__network, project, region)
22+
select
23+
'robot-subnet-01',
24+
'10.0.0.0/8',
25+
'An immutable ROBOT subnet description.',
26+
'projects/stackql-robot/global/networks/robot-vpc-01',
27+
'stackql-robot',
28+
'australia-southeast1'
29+
;
30+
The operation was despatched successfully
31+
32+
---
33+
select id, name, description, subnetworks from google.compute.networks where name = 'robot-vpc-01' and project = 'stackql-robot';
34+
|--------------------|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------|
35+
| id | name | description | subnetworks |
36+
|--------------------|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------|
37+
| 987158103920671616 | robot-vpc-01 | null | ["https://www.googleapis.com/compute/v1/projects/stackql-robot/regions/australia-southeast1/subnetworks/robot-subnet-01"] |
38+
|--------------------|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------|
39+
40+
--
41+
select name, id, secondaryIpRanges, fingerprint from google.compute.subnetworks where name = 'robot-subnet-01' and region = 'australia-southeast1' and project = 'stackql-robot' ;
42+
|-----------------|---------------------|-------------------|--------------|
43+
| name | id | secondaryIpRanges | fingerprint |
44+
|-----------------|---------------------|-------------------|--------------|
45+
| robot-subnet-01 | 7691273977604797678 | null | UNiA_jWveJI= |
46+
|-----------------|---------------------|-------------------|--------------|
47+
48+
49+
---
50+
update google.compute.subnetworks
51+
SET
52+
data__secondaryIpRanges = '[
53+
{
54+
"ipCidrRange": "192.168.0.0/24",
55+
"rangeName": "robot-range-01"
56+
}
57+
]',
58+
data__fingerprint = 'UNiA_jWveJI='
59+
WHERE
60+
project = 'stackql-robot'
61+
and
62+
region = 'australia-southeast1'
63+
and
64+
subnetwork = 'robot-subnet-01'
65+
;
66+
The operation was despatched successfully
67+
68+
--
69+
select name, id, secondaryIpRanges, fingerprint from google.compute.subnetworks where name = 'robot-subnet-01' and region = 'australia-southeast1' and project = 'stackql-robot' ;
70+
|-----------------|---------------------|-----------------------------------------------------------------|--------------|
71+
| name | id | secondaryIpRanges | fingerprint |
72+
|-----------------|---------------------|-----------------------------------------------------------------|--------------|
73+
| robot-subnet-01 | 7691273977604797678 | [{"ipCidrRange":"192.168.0.0/24","rangeName":"robot-range-01"}] | vmdP1iA6Cfc= |
74+
|-----------------|---------------------|-----------------------------------------------------------------|--------------|
75+
76+
77+
--
78+
delete from
79+
google.compute.subnetworks
80+
WHERE
81+
project = 'stackql-robot'
82+
and
83+
region = 'australia-southeast1'
84+
and
85+
subnetwork = 'robot-subnet-01'
86+
;
87+
<nil displayed response>
88+
89+
--
90+
select name, id, secondaryIpRanges, fingerprint from google.compute.subnetworks where name = 'robot-subnet-01' and region = 'australia-southeast1' and project = 'stackql-robot' ;
91+
|------|----|-------------------|-------------|
92+
| name | id | secondaryIpRanges | fingerprint |
93+
|------|----|-------------------|-------------|
94+
95+
96+
--
97+
delete from
98+
google.compute.networks
99+
WHERE
100+
project = 'stackql-robot'
101+
and
102+
network = 'robot-vpc-01'
103+
;
104+
<nil displayed response>
105+
106+
107+
--
108+
select id, name, description, subnetworks from google.compute.networks where name = 'robot-vpc-01' and project = 'stackql-robot';
109+
|----|------|-------------|-------------|
110+
| id | name | description | subnetworks |
111+
|----|------|-------------|-------------|
112+
113+
```
114+
115+
## Notes
116+
117+
- Even compute api is not on by default in a new google project.
118+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
*** Settings ***
2+
Resource ${CURDIR}/stackql.resource
3+
Test Teardown Stackql Per Test Teardown
4+
5+
*** Test Cases ***
6+
Google Buckets Lifecycle
7+
[Documentation] This test case inserts a bucket ("row") into the google.storage.buckets "table", checks the row was inserted, deletes the row, and checks the row was deleted.
8+
[Tags] google storage buckets gooogle.storage google.storage.buckets
9+
${insertInputStr} = Catenate
10+
... insert into google.storage.buckets(data__name, project)
11+
... select '${GCS_BUCKET_NAME}', '${GCP_PROJECT}';
12+
${checkInputStr} = Catenate
13+
... select name, "softDeleteTime", "hardDeleteTime" from google.storage.buckets where bucket = '${GCS_BUCKET_NAME}';
14+
${deleteInputStr} = Catenate
15+
... delete from google.storage.buckets where bucket = '${GCS_BUCKET_NAME}';
16+
Stock Stackql Exec Inline Equals Both Streams
17+
... ${insertInputStr}
18+
... ${EMPTY}
19+
... The operation was despatched successfully
20+
... Google-Buckets-Lifecycle-Insert
21+
Stock Stackql Exec Inline Equals Both Streams
22+
... ${checkInputStr}
23+
... ${EXPECTED_GCS_BUCKET_CHECK}
24+
... ${EMPTY}
25+
... Google-Buckets-Lifecycle-Post-Insert-Check
26+
Stock Stackql Exec Inline Equals Both Streams
27+
... ${deleteInputStr}
28+
... ${EMPTY}
29+
... The operation was despatched successfully
30+
... Google-Buckets-Lifecycle-Delete
31+
Sleep 5s
32+
Stock Stackql Exec Inline Equals Stdout
33+
... ${checkInputStr}
34+
... ${EXPECTED_EMPTY_GCS_BUCKET_CHECK}
35+
... Google-Buckets-Lifecycle-Post-Delete-Check
36+
37+
Google Network Lifecycle
38+
[Documentation] This test case inserts a VPC network then a subnet then mutates the subnet then deletes it and then deletes the network.
39+
[Tags] google compute networks subnetworks vpc gooogle.compute google.compute.networks google.compute.subnetworks Google${SPACE}Networks
40+
${insertNetworkInputStr} = Catenate
41+
... insert into google.compute.networks(data__name, data__autoCreateSubnetworks, project)
42+
... select 'robot-vpc-01', false, '${GCP_PROJECT}';
43+
${insertSubnetInputStr} = Catenate
44+
... insert into google.compute.subnetworks(
45+
... data__name,
46+
... data__ipCidrRange,
47+
... data__description,
48+
... data__network,
49+
... project,
50+
... region)
51+
... select
52+
... 'robot-subnet-01',
53+
... '10.0.0.0/8',
54+
... 'An immutable subnet description.',
55+
... 'projects/${GCP_PROJECT}/global/networks/robot-vpc-01',
56+
... '${GCP_PROJECT}',
57+
... 'australia-southeast1'
58+
... ;
59+
${getNetworkDetailQueryStr} = Catenate
60+
... select name, description, subnetworks
61+
... from google.compute.networks
62+
... where
63+
... name = 'robot-vpc-01'
64+
... and project = '${GCP_PROJECT}';
65+
${getSubnetDetailQueryStr} = Catenate
66+
... select name, secondaryIpRanges, fingerprint
67+
... from google.compute.subnetworks
68+
... where
69+
... name = 'robot-subnet-01'
70+
... and region = 'australia-southeast1'
71+
... and project = '${GCP_PROJECT}'
72+
... ;
73+
${insertNetworkInputStr} = Catenate
74+
... insert into google.compute.networks(data__name, data__autoCreateSubnetworks, project)
75+
... select 'robot-vpc-01', false, '${GCP_PROJECT}';
76+
${deleteNetworkStr} = Catenate
77+
... delete from google.compute.networks where network = 'robot-vpc-01' and project = '${GCP_PROJECT}';
78+
${deleteSubnetStr} = Catenate
79+
... delete from google.compute.subnetworks where subnetwork = 'robot-subnet-01' and project = '${GCP_PROJECT}' and region = 'australia-southeast1';
80+
Stock Stackql Exec Inline Equals Both Streams
81+
... ${insertNetworkInputStr}
82+
... ${EMPTY}
83+
... The operation was despatched successfully
84+
... Google-Network-Lifecycle-Insert-Network
85+
Sleep 20s
86+
${networkResult} = Catenate SEPARATOR=\n
87+
... |--------------|-------------|-------------|
88+
... |${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}name${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|${SPACE}description${SPACE}|${SPACE}subnetworks${SPACE}|
89+
... |--------------|-------------|-------------|
90+
... |${SPACE}robot-vpc-01${SPACE}|${SPACE}null${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|${SPACE}null${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|
91+
... |--------------|-------------|-------------|
92+
Stock Stackql Exec Inline Equals Both Streams
93+
... ${getNetworkDetailQueryStr}
94+
... ${networkResult}
95+
... ${EMPTY}
96+
... Google-Network-Lifecycle-Select-Network-01
97+
Sleep 20s
98+
Stock Stackql Exec Inline Equals Both Streams
99+
... ${insertSubnetInputStr}
100+
... ${EMPTY}
101+
... The operation was despatched successfully
102+
... Google-Network-Lifecycle-Insert-Subnet
103+
Sleep 20s
104+
${networkDetailResult} = Run Process
105+
... ${STACKQL_EXE}
106+
... \-\-output\=json
107+
... \-\-registry
108+
... ${REGISTRY_LOCAL_NO_VERIFY_CFG_STR}
109+
... exec
110+
... ${getNetworkDetailQueryStr}
111+
... stdout=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-network-detail-1.tmp
112+
... stderr=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-network-detail-1-stderr.tmp
113+
Log Detail dict string = ${networkDetailResult.stdout}
114+
${networkDetailDictList} = Evaluate json.loads($networkDetailResult.stdout)
115+
Log Detail is:${networkDetailDictList}[0]
116+
Should Contain ${networkDetailDictList[0]["subnetworks"]} robot\-subnet\-01
117+
${detailResult} = Run Process
118+
... ${STACKQL_EXE}
119+
... \-\-output\=json
120+
... \-\-registry
121+
... ${REGISTRY_LOCAL_NO_VERIFY_CFG_STR}
122+
... exec
123+
... ${getSubnetDetailQueryStr}
124+
... stdout=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-subnet-detail-1.tmp
125+
... stderr=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-subnet-detail-1-stderr.tmp
126+
Log Detail dict string = ${detailResult.stdout}
127+
${detailDict} = Evaluate json.loads($detailResult.stdout)
128+
Should Be Equal ${detailDict[0]["name"]} robot\-subnet\-01
129+
${CAPTURED_FINGERPRINT} = Set Variable ${detailDict[0]["fingerprint"]}
130+
${updateSubnetInputStr} = Catenate
131+
... update google.compute.subnetworks
132+
... SET
133+
... data__secondaryIpRanges = '[
134+
... {
135+
... "ipCidrRange": "192.168.0.0/24",
136+
... "rangeName": "s-r-01"
137+
... }
138+
... ]',
139+
... data__fingerprint = '${CAPTURED_FINGERPRINT}'
140+
... WHERE
141+
... project = '${GCP_PROJECT}'
142+
... and
143+
... region = 'australia-southeast1'
144+
... and
145+
... subnetwork = 'robot-subnet-01'
146+
... ;
147+
Stock Stackql Exec Inline Equals Both Streams
148+
... ${updateSubnetInputStr}
149+
... ${EMPTY}
150+
... The operation was despatched successfully
151+
... Google-Buckets-Lifecycle-Delete
152+
Sleep 30s
153+
${updatedDetailResult} = Run Process
154+
... ${STACKQL_EXE}
155+
... \-\-output\=json
156+
... \-\-registry
157+
... ${REGISTRY_LOCAL_NO_VERIFY_CFG_STR}
158+
... exec
159+
... ${getSubnetDetailQueryStr}
160+
... stdout=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-subnet-detail-2.tmp
161+
... stderr=${CURDIR}${/}tmp${/}Google-Network-Lifecycle-get-subnet-detail-2-stderr.tmp
162+
Log Updated detail dict string = ${updatedDetailResult.stdout}
163+
${updatedDetailDict} = Evaluate json.loads($updatedDetailResult.stdout)
164+
Should Contain ${updatedDetailDict[0]["secondaryIpRanges"]} 192.168.0.0/24
165+
Sleep 30s
166+
Stock Stackql Exec Inline Equals Both Streams
167+
... ${deleteSubnetStr}
168+
... ${EMPTY}
169+
... ${EMPTY}
170+
... Google-Network-Lifecycle-Subnet-Delete
171+
Sleep 20s
172+
${networkZeroSubnetResult} = Catenate SEPARATOR=\n
173+
... |--------------|-------------|-------------|
174+
... |${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}name${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|${SPACE}description${SPACE}|${SPACE}subnetworks${SPACE}|
175+
... |--------------|-------------|-------------|
176+
... |${SPACE}robot-vpc-01${SPACE}|${SPACE}null${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|${SPACE}null${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}|
177+
... |--------------|-------------|-------------|
178+
Stock Stackql Exec Inline Equals Both Streams
179+
... ${getNetworkDetailQueryStr}
180+
... ${networkZeroSubnetResult}
181+
... ${EMPTY}
182+
... Google-Network-Lifecycle-Select-Network-02
183+
Sleep 60s
184+
Stock Stackql Exec Inline Equals Both Streams
185+
... ${deleteNetworkStr}
186+
... ${EMPTY}
187+
... ${EMPTY}
188+
... Google-Network-Lifecycle-Network-Delete
189+
Sleep 20s
190+
${networkEmptyResult} = Catenate SEPARATOR=\n
191+
... |------|-------------|-------------|
192+
... |${SPACE}name${SPACE}|${SPACE}description${SPACE}|${SPACE}subnetworks${SPACE}|
193+
... |------|-------------|-------------|
194+
Stock Stackql Exec Inline Equals Both Streams
195+
... ${getNetworkDetailQueryStr}
196+
... ${networkEmptyResult}
197+
... ${EMPTY}
198+
... Google-Network-Lifecycle-Select-Network-03
199+
200+

0 commit comments

Comments
 (0)