Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
- name: Prepare load balancing materials
working-directory: stackql-core
run: |
sudo cp /etc/hosts /etc/hosts.bak
python3 test/python/tcp_lb.py --generate-hosts-entries | sudo tee -a /etc/hosts
python3 test/python/tcp_lb.py --generate-nginx-lb > test/tcp/reverse-proxy/nginx/dynamic-sni-proxy.conf

Expand Down Expand Up @@ -135,5 +136,51 @@ jobs:
if: always()
run: |
cat stackql-core/test/robot/reports/output.xml



- name: Post core test cleanup
run: |
pgrep -f flask | xargs kill -9 || true

- name: Run local registry mocked robot functional tests
if: success()
run: |
providerRoot="$(realpath $(pwd)/providers)"
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'"}'
robot \
--variable "${sundryCfg}" \
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \
-d test/robot/reports \
test/robot/stackql/mocked

- name: Output from local registry mocked functional tests
if: always()
run: |
cat test/robot/reports/output.xml

- name: Post registry mocked test cleanup
run: |
pgrep -f flask | xargs kill -9 || true
sudo nginx -s stop || true
sudo cp /etc/hosts.bak /etc/hosts || true
rm -f test/robot/reports/*.xml || true

- name: Run live robot functional tests
if: success()
id: live_integration_tests
env:
GOOGLE_CREDENTIALS: ${{ secrets.CI_SCENARIO_GCP_RO_SECRET }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RO_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RO_AWS_SECRET_ACCESS_KEY }}
run: |
providerRoot="$(realpath $(pwd)/providers)"
sundryCfg='SUNDRY_CONFIG:{"registry_path": "'"${providerRoot}"'"}'
robot \
--variable "${sundryCfg}" \
--variable SHOULD_RUN_DOCKER_EXTERNAL_TESTS:true \
-d test/robot/reports \
test/robot/stackql/live

- name: Output from live functional tests
if: always()
run: |
cat test/robot/reports/output.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ed25519tool
scripts/*/node_modules/
scripts/*/package-lock.json
stackql*.sh
stackql
/stackql
stackql-zip
.stackql/
stackql-core/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
|----------------------------------|--------------------------|--------------------|
| name | timeCreated | days_since_ceiling |
|----------------------------------|--------------------------|--------------------|
| staging.stackql-demo.appspot.com | 2023-02-26T08:35:40.223Z | 700 |
|----------------------------------|--------------------------|--------------------|
| stackql-encrypted-bucket-1 | 2023-02-28T03:18:33.043Z | 698 |
|----------------------------------|--------------------------|--------------------|
| stackql-demo.appspot.com | 2023-02-26T08:35:40.061Z | 700 |
|----------------------------------|--------------------------|--------------------|
| stackql-demo-src-bucket | 2022-02-08T23:23:47.208Z | 1083 |
|----------------------------------|--------------------------|--------------------|
| stackql-demo-bucket | 2022-02-09T04:39:09.058Z | 1082 |
|----------------------------------|--------------------------|--------------------|
| demo-app-bucket2 | 2023-02-17T05:34:26.958Z | 709 |
|----------------------------------|--------------------------|--------------------|
| demo-app-bucket1 | 2023-02-17T05:33:56.248Z | 709 |
|----------------------------------|--------------------------|--------------------|
14 changes: 14 additions & 0 deletions test/robot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Robot framework testing foor the registry

The following simple keywords are available:

- `Stock Stackql Exec Inline Equals Both Streams`.
- `Stock Stackql Exec Inline Contains Both Streams`.

Working examples are present, and you can add to them:

- 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.
- 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.

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.
2 changes: 2 additions & 0 deletions test/robot/reports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
5 changes: 5 additions & 0 deletions test/robot/stackql/live/__init__.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*** Settings ***
Resource ${CURDIR}/stackql.resource
Suite Setup Prepare StackQL Environment
Suite Teardown Terminate All Processes kill=True

18 changes: 18 additions & 0 deletions test/robot/stackql/live/live.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*** Settings ***
Resource ${CURDIR}/stackql.resource
Test Teardown Stackql Per Test Teardown

*** Test Cases ***
Google Buckets List With Date Logic Contains Exemplifies Use of SQLite Math Functions
Pass Execution If "${SQL_BACKEND}" == "postgres_tcp" This is a valid case where the test is targetted at SQLite only
${inputStr} = Catenate
... SELECT name, timeCreated, floor(julianday('2025-01-27')-julianday(timeCreated)) as days_since_ceiling
... FROM google.storage.buckets
... WHERE project = 'stackql-demo'
... order by name desc
... ;
Stock Stackql Exec Inline Contains Both Streams
... ${inputStr}
... days_since_ceiling
... ${EMPTY}
... Google-Buckets-List-With-Date-Logic-Contains-Exemplifies-Use-of-SQLite-Math-Functions
73 changes: 73 additions & 0 deletions test/robot/stackql/live/stackql.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
*** Variables ***
${REPOSITORY_ROOT} ${CURDIR}${/}..${/}..${/}..${/}..
${CORE_REPOSITORY_ROOT} ${REPOSITORY_ROOT}${/}stackql-core
${CORE_LIB_HOME} ${CORE_REPOSITORY_ROOT}${/}test${/}robot${/}lib
${LOCAL_LIB_HOME} ${CURDIR}${/}..${/}..${/}lib
${EXECUTION_PLATFORM} native # to be overridden from command line, eg "docker"
${SQL_BACKEND} sqlite_embedded # to be overridden from command line, eg "postgres_tcp"
${IS_WSL} false # to be overridden from command line, with string "true"
${SHOULD_RUN_DOCKER_EXTERNAL_TESTS} false # to be overridden from command line, with string "true"
${CONCURRENCY_LIMIT} 1 # to be overridden from command line, with integer value, -1 for no limit
${USE_STACKQL_PREINSTALLED} false # to be overridden from command line, with string "true"
${SUNDRY_CONFIG} {} # to be overridden from command line, with string value
${CORE_PREFIX} stackql-core

*** Settings ***
Library Process
Library OperatingSystem
Variables ${CORE_LIB_HOME}/stackql_context.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${USE_STACKQL_PREINSTALLED}
... ${SUNDRY_CONFIG}
Library Process
Library OperatingSystem
Library String
Library ${CORE_LIB_HOME}/StackQLInterfaces.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${CONCURRENCY_LIMIT}
Library ${CORE_LIB_HOME}/CloudIntegration.py

*** Keywords ***


Prepare StackQL Environment
Sleep 10s

Stock Stackql Exec Inline Equals Both Streams
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
Should Stackql Exec Inline Equal Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... {}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${outputStr}
... ${outputStderrStr}
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp

Stock Stackql Exec Inline Contains Both Streams
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
Should Stackql Exec Inline Contain Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... {}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${outputStr}
... ${outputStderrStr}
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp


Stackql Per Test Teardown
IF "${EXECUTION_PLATFORM}" == "docker" and "${SQL_BACKEND}" == "postgres_tcp"
${res} = Run Process bash \-c docker kill $(docker ps \-\-filter name\=execrun \-q)
Log Container killed
# Should Be Equal As Integers ${res.rc} 0
${restwo} = Run Process bash \-c docker rm $(docker ps \-\-filter status\=exited \-q)
Log Container removed
# Should Be Equal As Integers ${restwo.rc} 0
END
2 changes: 2 additions & 0 deletions test/robot/stackql/live/tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
5 changes: 5 additions & 0 deletions test/robot/stackql/mocked/__init__.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*** Settings ***
Resource ${CURDIR}/stackql.resource
Suite Setup Prepare StackQL Environment
Suite Teardown Terminate All Processes kill=True

19 changes: 19 additions & 0 deletions test/robot/stackql/mocked/adhoc.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*** Settings ***
Resource ${CURDIR}/stackql.resource
Test Teardown Stackql Per Test Teardown

*** Test Cases ***
Google Buckets List With Date Logic Exemplifies Use of SQLite Math Functions
Pass Execution If "${SQL_BACKEND}" == "postgres_tcp" This is a valid case where the test is targetted at SQLite only
${inputStr} = Catenate
... SELECT name, timeCreated, floor(julianday('2025-01-27')-julianday(timeCreated)) as days_since_ceiling
... FROM google.storage.buckets
... WHERE project = 'stackql-demo'
... order by name desc
... ;
${outputStr} = Get File ${REPOSITORY_ROOT}${/}test${/}expectations${/}mocked${/}google-storage-buckets-list-date-logic.txt
Stock Stackql Exec Inline Equals Both Streams
... ${inputStr}
... ${outputStr}
... ${EMPTY}
... Google-Buckets-List-With-Date-Logic-Exemplifies-Use-of-SQLite-Math-Functions
105 changes: 105 additions & 0 deletions test/robot/stackql/mocked/stackql.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
*** Variables ***
${REPOSITORY_ROOT} ${CURDIR}${/}..${/}..${/}..${/}..
${CORE_REPOSITORY_ROOT} ${REPOSITORY_ROOT}${/}stackql-core
${CORE_LIB_HOME} ${CORE_REPOSITORY_ROOT}${/}test${/}robot${/}lib
${LOCAL_LIB_HOME} ${CURDIR}${/}..${/}..${/}lib
${EXECUTION_PLATFORM} native # to be overridden from command line, eg "docker"
${SQL_BACKEND} sqlite_embedded # to be overridden from command line, eg "postgres_tcp"
${IS_WSL} false # to be overridden from command line, with string "true"
${SHOULD_RUN_DOCKER_EXTERNAL_TESTS} false # to be overridden from command line, with string "true"
${CONCURRENCY_LIMIT} 1 # to be overridden from command line, with integer value, -1 for no limit
${USE_STACKQL_PREINSTALLED} false # to be overridden from command line, with string "true"
${SUNDRY_CONFIG} {} # to be overridden from command line, with string value
${CORE_PREFIX} stackql-core

*** Settings ***
Library Process
Library OperatingSystem
Variables ${CORE_LIB_HOME}/stackql_context.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${USE_STACKQL_PREINSTALLED}
... ${SUNDRY_CONFIG}
Library Process
Library OperatingSystem
Library String
Library ${CORE_LIB_HOME}/StackQLInterfaces.py ${EXECUTION_PLATFORM} ${SQL_BACKEND} ${CONCURRENCY_LIMIT}
Library ${CORE_LIB_HOME}/CloudIntegration.py
Library ${CORE_LIB_HOME}/web_service_keywords.py
... app_root=${CORE_PREFIX}/test/python/flask
... tls_key_path=${CORE_PREFIX}/test/server/mtls/credentials/pg_server_key.pem
... tls_cert_path=${CORE_PREFIX}/test/server/mtls/credentials/pg_server_cert.pem

*** Keywords ***

Start All Mock Servers
${port_dict} = Create Dictionary
... oauth_client_credentials_token=${MOCKSERVER_PORT_OAUTH_CLIENT_CREDENTIALS_TOKEN}
... github=${MOCKSERVER_PORT_GITHUB}
... google=${MOCKSERVER_PORT_GOOGLE}
... okta=${MOCKSERVER_PORT_OKTA}
... aws=${MOCKSERVER_PORT_AWS}
... stackql_auth_testing=${MOCKSERVER_PORT_STACKQL_AUTH_TESTING}
... googleadmin=${MOCKSERVER_PORT_GOOGLEADMIN}
... k8s=${MOCKSERVER_PORT_K8S}
... registry=${MOCKSERVER_PORT_REGISTRY}
... azure=${MOCKSERVER_PORT_AZURE}
... sumologic=${MOCKSERVER_PORT_SUMOLOGIC}
... digitalocean=${MOCKSERVER_PORT_DIGITALOCEAN}
Start All Webservers port_dict=${port_dict}


Prepare StackQL Environment
Set Environment Variable OKTA_SECRET_KEY ${OKTA_SECRET_STR}
Set Environment Variable GITHUB_SECRET_KEY ${GITHUB_SECRET_STR}
Set Environment Variable K8S_SECRET_KEY ${K8S_SECRET_STR}
Set Environment Variable AZ_ACCESS_TOKEN ${AZURE_SECRET_STR}
Set Environment Variable SUMO_CREDS ${SUMOLOGIC_SECRET_STR}
Set Environment Variable DIGITALOCEAN_TOKEN ${DIGITALOCEAN_SECRET_STR}
Set Environment Variable DUMMY_DIGITALOCEAN_USERNAME ${DUMMY_DIGITALOCEAN_USERNAME_STR}
Set Environment Variable DUMMY_DIGITALOCEAN_PASSWORD ${DUMMY_DIGITALOCEAN_PASSWORD_STR}
Set Environment Variable DB_SETUP_SRC ${DB_SETUP_SRC}
Set Environment Variable GOOGLE_APPLICATION_CREDENTIALS ${GOOGLE_APPLICATION_CREDENTIALS}
Set Environment Variable DD_API_KEY %{DD_API_KEY=myusername}
Set Environment Variable DD_APPLICATION_KEY %{DD_APPLICATION_KEY=mypassword}
Start All Mock Servers
Sleep 50s

Stock Stackql Exec Inline Equals Both Streams
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
Should Stackql Exec Inline Equal Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... ${AUTH_CFG_STR}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${outputStr}
... ${outputStderrStr}
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp

Stock Stackql Exec Inline Contains Both Streams
[Arguments] ${inputStr} ${outputStr} ${outputStderrStr} ${tmpFileTrunk}
Should Stackql Exec Inline Contain Both Streams
... ${STACKQL_EXE}
... ${OKTA_SECRET_STR}
... ${GITHUB_SECRET_STR}
... ${K8S_SECRET_STR}
... ${REGISTRY_NO_VERIFY_CFG_STR}
... {}
... ${SQL_BACKEND_CFG_STR_CANONICAL}
... ${inputStr}
... ${outputStr}
... ${outputStderrStr}
... stdout=${CURDIR}${/}tmp${/}${tmpFileTrunk}.tmp
... stderr=${CURDIR}${/}tmp${/}${tmpFileTrunk}-stderr.tmp

Stackql Per Test Teardown
IF "${EXECUTION_PLATFORM}" == "docker" and "${SQL_BACKEND}" == "postgres_tcp"
${res} = Run Process bash \-c docker kill $(docker ps \-\-filter name\=execrun \-q)
Log Container killed
# Should Be Equal As Integers ${res.rc} 0
${restwo} = Run Process bash \-c docker rm $(docker ps \-\-filter status\=exited \-q)
Log Container removed
# Should Be Equal As Integers ${restwo.rc} 0
END
2 changes: 2 additions & 0 deletions test/robot/stackql/mocked/tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore