Skip to content

Commit 20a1b0c

Browse files
Merge pull request #297 from stackql/feature/improved-ci-options-min
improved-ci-options
2 parents 765b302 + 31cc600 commit 20a1b0c

File tree

13 files changed

+312
-3
lines changed

13 files changed

+312
-3
lines changed

.github/workflows/regression.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ jobs:
9393
- name: Prepare load balancing materials
9494
working-directory: stackql-core
9595
run: |
96+
sudo cp /etc/hosts /etc/hosts.bak
9697
python3 test/python/tcp_lb.py --generate-hosts-entries | sudo tee -a /etc/hosts
9798
python3 test/python/tcp_lb.py --generate-nginx-lb > test/tcp/reverse-proxy/nginx/dynamic-sni-proxy.conf
9899
@@ -135,5 +136,51 @@ jobs:
135136
if: always()
136137
run: |
137138
cat stackql-core/test/robot/reports/output.xml
138-
139-
139+
140+
- name: Post core test cleanup
141+
run: |
142+
pgrep -f flask | xargs kill -9 || true
143+
144+
- name: Run local registry mocked robot functional tests
145+
if: success()
146+
run: |
147+
providerRoot="$(realpath $(pwd)/providers)"
148+
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'"}'
149+
robot \
150+
--variable "${sundryCfg}" \
151+
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \
152+
-d test/robot/reports \
153+
test/robot/stackql/mocked
154+
155+
- name: Output from local registry mocked functional tests
156+
if: always()
157+
run: |
158+
cat test/robot/reports/output.xml
159+
160+
- name: Post registry mocked test cleanup
161+
run: |
162+
pgrep -f flask | xargs kill -9 || true
163+
sudo nginx -s stop || true
164+
sudo cp /etc/hosts.bak /etc/hosts || true
165+
rm -f test/robot/reports/*.xml || true
166+
167+
- name: Run live robot functional tests
168+
if: success()
169+
id: live_integration_tests
170+
env:
171+
GOOGLE_CREDENTIALS: ${{ secrets.CI_SCENARIO_GCP_RO_SECRET }}
172+
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RO_AWS_ACCESS_KEY_ID }}
173+
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RO_AWS_SECRET_ACCESS_KEY }}
174+
run: |
175+
providerRoot="$(realpath $(pwd)/providers)"
176+
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'"}'
177+
robot \
178+
--variable "${sundryCfg}" \
179+
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \
180+
-d test/robot/reports \
181+
test/robot/stackql/live
182+
183+
- name: Output from live functional tests
184+
if: always()
185+
run: |
186+
cat test/robot/reports/output.xml

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ed25519tool
33
scripts/*/node_modules/
44
scripts/*/package-lock.json
55
stackql*.sh
6-
stackql
6+
/stackql
77
stackql-zip
88
.stackql/
99
stackql-core/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
|----------------------------------|--------------------------|--------------------|
2+
| name | timeCreated | days_since_ceiling |
3+
|----------------------------------|--------------------------|--------------------|
4+
| staging.stackql-demo.appspot.com | 2023-02-26T08:35:40.223Z | 700 |
5+
|----------------------------------|--------------------------|--------------------|
6+
| stackql-encrypted-bucket-1 | 2023-02-28T03:18:33.043Z | 698 |
7+
|----------------------------------|--------------------------|--------------------|
8+
| stackql-demo.appspot.com | 2023-02-26T08:35:40.061Z | 700 |
9+
|----------------------------------|--------------------------|--------------------|
10+
| stackql-demo-src-bucket | 2022-02-08T23:23:47.208Z | 1083 |
11+
|----------------------------------|--------------------------|--------------------|
12+
| stackql-demo-bucket | 2022-02-09T04:39:09.058Z | 1082 |
13+
|----------------------------------|--------------------------|--------------------|
14+
| demo-app-bucket2 | 2023-02-17T05:34:26.958Z | 709 |
15+
|----------------------------------|--------------------------|--------------------|
16+
| demo-app-bucket1 | 2023-02-17T05:33:56.248Z | 709 |
17+
|----------------------------------|--------------------------|--------------------|

test/robot/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
# Robot framework testing foor the registry
3+
4+
The following simple keywords are available:
5+
6+
- `Stock Stackql Exec Inline Equals Both Streams`.
7+
- `Stock Stackql Exec Inline Contains Both Streams`.
8+
9+
Working examples are present, and you can add to them:
10+
11+
- For live tests, add to [`stackql/live/live.robot`](/test/robot/stackql/live/live.robot). Authentication credentials must be supplied in the environment for any query under test.
12+
- For moocked tests, add to [`stackql/mocked/adhoc.robot`](/test/robot/stackql/mocked/adhoc.robot). Mocking capability must be present for any query under test.
13+
14+
Additionally, more complex keywords are available and more complex scenarios are supported. Examples of such will be added on a needs basis, for corner cases.

test/robot/reports/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*** Settings ***
2+
Resource ${CURDIR}/stackql.resource
3+
Suite Setup Prepare StackQL Environment
4+
Suite Teardown Terminate All Processes kill=True
5+

test/robot/stackql/live/live.robot

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*** Settings ***
2+
Resource ${CURDIR}/stackql.resource
3+
Test Teardown Stackql Per Test Teardown
4+
5+
*** Test Cases ***
6+
Google Buckets List With Date Logic Contains Exemplifies Use of SQLite Math Functions
7+
Pass Execution If "${SQL_BACKEND}" == "postgres_tcp" This is a valid case where the test is targetted at SQLite only
8+
${inputStr} = Catenate
9+
... SELECT name, timeCreated, floor(julianday('2025-01-27')-julianday(timeCreated)) as days_since_ceiling
10+
... FROM google.storage.buckets
11+
... WHERE project = 'stackql-demo'
12+
... order by name desc
13+
... ;
14+
Stock Stackql Exec Inline Contains Both Streams
15+
... ${inputStr}
16+
... days_since_ceiling
17+
... ${EMPTY}
18+
... Google-Buckets-List-With-Date-Logic-Contains-Exemplifies-Use-of-SQLite-Math-Functions
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
*** Variables ***
2+
${REPOSITORY_ROOT} ${CURDIR}${/}..${/}..${/}..${/}..
3+
${CORE_REPOSITORY_ROOT} ${REPOSITORY_ROOT}${/}stackql-core
4+
${CORE_LIB_HOME} ${CORE_REPOSITORY_ROOT}${/}test${/}robot${/}lib
5+
${LOCAL_LIB_HOME} ${CURDIR}${/}..${/}..${/}lib
6+
${EXECUTION_PLATFORM} native # to be overridden from command line, eg "docker"
7+
${SQL_BACKEND} sqlite_embedded # to be overridden from command line, eg "postgres_tcp"
8+
${IS_WSL} false # to be overridden from command line, with string "true"
9+
${SHOULD_RUN_DOCKER_EXTERNAL_TESTS} false # to be overridden from command line, with string "true"
10+
${CONCURRENCY_LIMIT} 1 # to be overridden from command line, with integer value, -1 for no limit
11+
${USE_STACKQL_PREINSTALLED} false # to be overridden from command line, with string "true"
12+
${SUNDRY_CONFIG} {} # to be overridden from command line, with string value
13+
${CORE_PREFIX} stackql-core
14+
15+
*** Settings ***
16+
Library Process
17+
Library OperatingSystem
18+
Variables ${CORE_LIB_HOME}/stackql_context.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${USE_STACKQL_PREINSTALLED}
19+
... ${SUNDRY_CONFIG}
20+
Library Process
21+
Library OperatingSystem
22+
Library String
23+
Library ${CORE_LIB_HOME}/StackQLInterfaces.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${CONCURRENCY_LIMIT}
24+
Library ${CORE_LIB_HOME}/CloudIntegration.py
25+
26+
*** Keywords ***
27+
28+
29+
Prepare StackQL Environment
30+
Sleep 10s
31+
32+
Stock Stackql Exec Inline Equals Both Streams
33+
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
34+
Should Stackql Exec Inline Equal Both Streams
35+
... ${STACKQL_EXE}
36+
... ${OKTA_SECRET_STR}
37+
... ${GITHUB_SECRET_STR}
38+
... ${K8S_SECRET_STR}
39+
... ${REGISTRY_NO_VERIFY_CFG_STR}
40+
... {}
41+
... ${SQL_BACKEND_CFG_STR_CANONICAL}
42+
... ${inputStr}
43+
... ${outputStr}
44+
... ${outputStderrStr}
45+
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
46+
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp
47+
48+
Stock Stackql Exec Inline Contains Both Streams
49+
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
50+
Should Stackql Exec Inline Contain Both Streams
51+
... ${STACKQL_EXE}
52+
... ${OKTA_SECRET_STR}
53+
... ${GITHUB_SECRET_STR}
54+
... ${K8S_SECRET_STR}
55+
... ${REGISTRY_NO_VERIFY_CFG_STR}
56+
... {}
57+
... ${SQL_BACKEND_CFG_STR_CANONICAL}
58+
... ${inputStr}
59+
... ${outputStr}
60+
... ${outputStderrStr}
61+
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
62+
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp
63+
64+
65+
Stackql Per Test Teardown
66+
IF "${EXECUTION_PLATFORM}" == "docker" and "${SQL_BACKEND}" == "postgres_tcp"
67+
${res} = Run Process bash \-c docker kill $(docker ps \-\-filter name\=execrun \-q)
68+
Log Container killed
69+
# Should Be Equal As Integers ${res.rc} 0
70+
${restwo} = Run Process bash \-c docker rm $(docker ps \-\-filter status\=exited \-q)
71+
Log Container removed
72+
# Should Be Equal As Integers ${restwo.rc} 0
73+
END
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*** Settings ***
2+
Resource ${CURDIR}/stackql.resource
3+
Suite Setup Prepare StackQL Environment
4+
Suite Teardown Terminate All Processes kill=True
5+

0 commit comments

Comments
 (0)