Skip to content

Commit faab96b

Browse files
Feature/testing portable compact (#542)
testing-portable Summary: - Enhance testing portability. - Parameterised robot test lib import. - New version `any-sdk`. - Test `python` changes. - Actions `linuxtest` is de facto validation of python package.
1 parent 140a764 commit faab96b

File tree

234 files changed

+2828
-1444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+2828
-1444
lines changed

.github/workflows/build.yml

Lines changed: 94 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929

3030
env:
3131
GOTESTCMD: "go test -timeout 1200s --tags \"sqlite_stackql\" -v ./..."
32-
TESTSCRIPT: "test/python/main.py"
32+
TESTSCRIPT: "test/deprecated/python/main.py"
3333
GOPRIVATE: github.com/stackql/*
3434
GH_ACCESS_TOKEN: ${{ secrets.ACTIONS_PRIVATE_PACKAGE_SECRET }}
3535
PLANCACHEENABLED: "false"
@@ -39,6 +39,42 @@ env:
3939

4040
jobs:
4141

42+
test_python_package_build:
43+
# id: test_python_package_build
44+
name: Test Python Package Build
45+
runs-on: ubuntu-22.04
46+
timeout-minutes: ${{ vars.DEFAULT_JOB_TIMEOUT_MIN == '' && 120 || vars.DEFAULT_JOB_TIMEOUT_MIN }}
47+
steps:
48+
49+
- name: Check out code into the Go module directory
50+
uses: actions/[email protected]
51+
52+
- name: Setup Python
53+
uses: actions/[email protected]
54+
with:
55+
cache: pip
56+
python-version: '3.12'
57+
58+
- name: Install Poetry
59+
uses: snok/install-poetry@v1
60+
with:
61+
version: 1.8.3
62+
virtualenvs-create: true
63+
virtualenvs-in-project: false
64+
virtualenvs-path: ~/my-custom-path
65+
installer-parallel: true
66+
67+
- name: Build package
68+
run: |
69+
cicd/util/01-build-robot-lib.sh
70+
71+
- name: Upload python package artifact
72+
uses: actions/[email protected]
73+
with:
74+
name: python-package-dist-folder
75+
path: test/dist
76+
77+
4278
winbuild:
4379
name: Windows Build
4480
runs-on: windows-latest
@@ -65,7 +101,7 @@ jobs:
65101

66102
with:
67103
cache: pip
68-
python-version: '3.11'
104+
python-version: '3.12'
69105

70106
- name: Cache Chocolatey packages
71107
id: cache-choco
@@ -119,7 +155,7 @@ jobs:
119155
120156
- name: Generate rewritten registry for simulations
121157
run: |
122-
python3 test\python\registry-rewrite.py
158+
python3 test\python\stackql_test_tooling\registry_rewrite.py --srcdir "$pwd\test\registry\src" --destdir "$pwd\test\registry-mocked\src"
123159
124160
- name: Get dependencies
125161
run: |
@@ -170,6 +206,7 @@ jobs:
170206
env:
171207
PSQL_EXE: C:\Program Files\PostgreSQL\13\bin\psql
172208
SQLITE_EXE: C:\ProgramData\chocolatey\lib\SQLite\tools\sqlite3.exe
209+
PYTHONPATH: '${{ env.PYTHONPATH }};${{ github.workspace }}\test\python'
173210
run: |
174211
python cicd/python/build.py --robot-test
175212
@@ -187,6 +224,7 @@ jobs:
187224
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
188225
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
189226
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
227+
PYTHONPATH: '${{ env.PYTHONPATH }};${{ github.workspace }}\test\python'
190228
run: | #Ideally there wiuld be forced kill of flaks here but dont know how to do that in windows
191229
python cicd/python/build.py --robot-test-integration
192230
@@ -196,7 +234,7 @@ jobs:
196234

197235
- name: Test Script
198236
if: success()
199-
run: python.exe test/python/main.py
237+
run: python.exe test/deprecated/python/main.py
200238

201239
- name: Upload Artifact
202240
# uses: actions/upload-artifact@v3
@@ -227,7 +265,7 @@ jobs:
227265
uses: actions/[email protected]
228266
with:
229267
cache: pip
230-
python-version: '3.11'
268+
python-version: '3.12'
231269

232270
- name: Git Ref Parse
233271
id: git_ref_parse
@@ -256,7 +294,7 @@ jobs:
256294
257295
- name: Generate rewritten registry for simulations
258296
run: |
259-
python3 test/python/registry-rewrite.py
297+
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"
260298
261299
- name: Get dependencies
262300
run: |
@@ -398,6 +436,7 @@ jobs:
398436
name: Linux Test
399437
needs:
400438
- linuxbuild
439+
- test_python_package_build
401440
runs-on: ubuntu-22.04
402441
strategy:
403442
matrix:
@@ -446,7 +485,21 @@ jobs:
446485
uses: actions/[email protected]
447486
with:
448487
cache: pip
449-
python-version: '3.11'
488+
python-version: '3.12'
489+
490+
- name: Download python package dist folder
491+
uses: actions/[email protected]
492+
with:
493+
name: python-package-dist-folder
494+
path: test/dist
495+
496+
- name: Install python testing package
497+
run: |
498+
echo "Inspecting python package"
499+
for file in test/dist/*.whl; do
500+
pip3 install "$file" --force-reinstall
501+
done
502+
450503
451504
- name: Git Ref Parse
452505
id: git_ref_parse
@@ -494,8 +547,8 @@ jobs:
494547
} >> "${GITHUB_ENV}"
495548
496549
if [ "${{ matrix.registry }}" = "test/registry" ]; then
497-
python3 test/python/tcp_lb.py --generate-hosts-entries | sudo tee -a /etc/hosts
498-
python3 test/python/tcp_lb.py --generate-nginx-lb > test/tcp/reverse-proxy/nginx/dynamic-sni-proxy.conf
550+
python3 test/python/stackql_test_tooling/tcp_lb.py --generate-hosts-entries | sudo tee -a /etc/hosts
551+
python3 test/python/stackql_test_tooling/tcp_lb.py --generate-nginx-lb > test/tcp/reverse-proxy/nginx/dynamic-sni-proxy.conf
499552
fi
500553
501554
@@ -523,7 +576,7 @@ jobs:
523576
- name: Generate rewritten registry for simulations
524577
if: ${{ matrix.registry != 'test/registry' }}
525578
run: |
526-
python3 test/python/registry-rewrite.py
579+
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"
527580
528581
- name: Create certificates for robot tests
529582
run: |
@@ -532,6 +585,8 @@ jobs:
532585
openssl req -x509 -keyout test/server/mtls/credentials/pg_rubbish_key.pem -out test/server/mtls/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365
533586
534587
- name: Run robot mocked functional tests
588+
env:
589+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
535590
if: success()
536591
run: |
537592
if [ "${{ matrix.registry }}" = "test/registry" ]; then
@@ -588,6 +643,8 @@ jobs:
588643

589644
- name: install and test deb package
590645
if: matrix.registry != 'test/registry'
646+
env:
647+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
591648
run: |
592649
mkdir -p deb_test
593650
cp stackql_${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}}_amd64.deb deb_test/
@@ -604,6 +661,8 @@ jobs:
604661
605662
- name: Output from mocked deb package functional tests
606663
if: always() && matrix.registry != 'test/registry'
664+
env:
665+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
607666
run: |
608667
cat ./test/robot/reports/output.xml
609668
@@ -628,7 +687,7 @@ jobs:
628687
uses: actions/[email protected]
629688
with:
630689
cache: pip
631-
python-version: '3.11'
690+
python-version: '3.12'
632691

633692
- name: Git Ref Parse
634693
id: git_ref_parse
@@ -653,7 +712,7 @@ jobs:
653712
654713
- name: Generate rewritten registry for simulations
655714
run: |
656-
python3 test/python/registry-rewrite.py
715+
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"
657716
658717
- name: Get dependencies
659718
run: |
@@ -766,6 +825,8 @@ jobs:
766825
openssl req -x509 -keyout test/server/mtls/credentials/pg_rubbish_key.pem -out test/server/mtls/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365
767826
768827
- name: Run robot mocked functional tests
828+
env:
829+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
769830
if: success()
770831
run: |
771832
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true" } }'
@@ -776,6 +837,8 @@ jobs:
776837
cat ./test/robot/reports/output.xml
777838
778839
- name: Run robot mocked functional tests with aggressive concurrency
840+
env:
841+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
779842
if: success()
780843
run: |
781844
echo "## Stray flask apps to be killed before robot tests ##"
@@ -795,6 +858,7 @@ jobs:
795858
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
796859
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
797860
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
861+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
798862
run: |
799863
echo "## Stray flask apps to be killed before robot tests ##"
800864
pgrep -f flask | xargs kill -9 || true
@@ -862,6 +926,7 @@ jobs:
862926
pkgName: 'stackql'
863927
pkgVersion: ${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}}
864928
pkgArchitecture: 'arm64'
929+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
865930
run: |
866931
mkdir -p deb_test
867932
DEB_FILE="${pkgName}_${pkgVersion}_${pkgArchitecture}.deb"
@@ -937,7 +1002,7 @@ jobs:
9371002

9381003
- shell: wsl-bash {0}
9391004
name: Generate rewritten registry for simulations
940-
run: python3 test/python/registry-rewrite.py
1005+
run: python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"
9411006

9421007
- shell: wsl-bash {0}
9431008
name: Create certificates for robot tests
@@ -962,6 +1027,7 @@ jobs:
9621027
then
9631028
export BUILDPATCHVERSION="${BUILDPATCHVERSION}"
9641029
fi
1030+
export PYTHONPATH="$(pwd)/test/python"
9651031
python3 cicd/python/build.py --robot-test --config='{ "variables": { "IS_WSL": true } }'
9661032
9671033
- shell: wsl-bash {0}
@@ -975,7 +1041,7 @@ jobs:
9751041
# This is a hack because if cannot directly access secrets
9761042
if: env.AZURE_CLIENT_SECRET != ''
9771043
env:
978-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
1044+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
9791045
run: |
9801046
. cicd/version.txt
9811047
export AZURE_CLIENT_ID='${{ secrets.AZURE_CLIENT_ID }}'
@@ -997,6 +1063,7 @@ jobs:
9971063
echo "## Stray flask apps to be killed before robot tests ##"
9981064
pgrep -f flask | xargs kill -9 || true
9991065
echo "## End ##"
1066+
export PYTHONPATH="$(pwd)/test/python"
10001067
python3 cicd/python/build.py --robot-test-integration --config='{ "variables": { "IS_WSL": true } }'
10011068
10021069
macosbuild:
@@ -1019,7 +1086,7 @@ jobs:
10191086
uses: actions/[email protected]
10201087
with:
10211088
cache: pip
1022-
python-version: '3.11'
1089+
python-version: '3.12'
10231090

10241091
- name: Git Ref Parse
10251092
id: git_ref_parse
@@ -1037,7 +1104,7 @@ jobs:
10371104
10381105
- name: Generate rewritten registry for simulations
10391106
run: |
1040-
python3 test/python/registry-rewrite.py
1107+
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src"
10411108
10421109
- name: Get dependencies
10431110
run: |
@@ -1096,6 +1163,8 @@ jobs:
10961163
openssl req -x509 -keyout test/server/mtls/credentials/pg_rubbish_key.pem -out test/server/mtls/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365
10971164
10981165
- name: Run robot mocked functional tests
1166+
env:
1167+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
10991168
if: success()
11001169
run: |
11011170
python cicd/python/build.py --robot-test
@@ -1112,6 +1181,7 @@ jobs:
11121181
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
11131182
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
11141183
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
1184+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
11151185
run: |
11161186
echo "## Stray flask apps to be killed before robot tests ##"
11171187
pgrep -f flask | xargs kill -9 || true
@@ -1148,7 +1218,7 @@ jobs:
11481218
uses: actions/[email protected]
11491219
with:
11501220
cache: pip
1151-
python-version: '3.11'
1221+
python-version: '3.12'
11521222

11531223
- name: Set up Go 1.x
11541224
uses: actions/[email protected]
@@ -1547,7 +1617,7 @@ jobs:
15471617
uses: actions/[email protected]
15481618
with:
15491619
cache: pip
1550-
python-version: '3.11'
1620+
python-version: '3.12'
15511621

15521622
# for some reason skipping this with env.BUILD_IMAGE_REQUIRED == 'true' breaks python cleanup where it can't find pip cache
15531623
- name: Install Python dependencies
@@ -1557,7 +1627,7 @@ jobs:
15571627
- name: Generate rewritten registry for simulations
15581628
if: env.BUILD_IMAGE_REQUIRED == 'true'
15591629
run: |
1560-
python3 test/python/registry-rewrite.py --replacement-host=host.docker.internal
1630+
python3 test/python/stackql_test_tooling/registry_rewrite.py --srcdir "$(pwd)/test/registry/src" --destdir "$(pwd)/test/registry-mocked/src" --replacement-host=host.docker.internal
15611631
15621632
15631633
- name: Create certificates for robot tests
@@ -1571,6 +1641,8 @@ jobs:
15711641
openssl req -x509 -keyout cicd/vol/srv/credentials/pg_rubbish_key.pem -out cicd/vol/srv/credentials/pg_rubbish_cert.pem -config test/server/mtls/openssl.cnf -days 365
15721642
15731643
- name: Run robot mocked functional tests
1644+
env:
1645+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
15741646
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true' && matrix.db_backend == 'sqlite'
15751647
timeout-minutes: ${{ vars.DEFAULT_STEP_TIMEOUT_MIN == '' && 20 || vars.DEFAULT_STEP_TIMEOUT_MIN }}
15761648
run: |
@@ -1579,6 +1651,8 @@ jobs:
15791651
python cicd/python/build.py --robot-test --config='{ "variables": { "EXECUTION_PLATFORM": "docker" } }'
15801652
15811653
- name: Run POSTGRES BACKEND robot mocked functional tests
1654+
env:
1655+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
15821656
if: success() && env.CI_IS_EXPRESS != 'true' && matrix.platform == 'linux/amd64' && env.BUILD_IMAGE_REQUIRED == 'true' && matrix.db_backend == 'postgres_tcp'
15831657
timeout-minutes: ${{ vars.DEFAULT_LONG_STEP_TIMEOUT_MIN == '' && 40 || vars.DEFAULT_LONG_STEP_TIMEOUT_MIN }}
15841658
run: |
@@ -1610,6 +1684,7 @@ jobs:
16101684
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
16111685
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
16121686
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
1687+
PYTHONPATH: '${{ env.PYTHONPATH }}:${{ github.workspace }}/test/python'
16131688
run: |
16141689
sudo rm -rf test/tmp || true
16151690
mkdir -p test/tmp

.github/workflows/scenario.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ jobs:
9999
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RO_AWS_ACCESS_KEY_ID }}
100100
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RO_AWS_SECRET_ACCESS_KEY }}
101101
run: |
102-
python3 test/python/markdown_testing/markdown_testing.py --test-root=docs/walkthroughs/readonly 2>&1 | tee cicd/log/markdown-readonly-testing-results.log
102+
python3 test/python/markdown_testing/markdown_testing.py "$(pwd)" --test-root=docs/walkthroughs/readonly 2>&1 | tee cicd/log/markdown-readonly-testing-results.log
103103
104104
- name: Run Read Write Walkthrough Scenarios
105105
if: ${{ env.runType == env.RUNTYPE_READ_WRITE || env.runType == env.RUNTYPE_ALL }}
106106
env:
107107
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RW_AWS_ACCESS_KEY_ID }}
108108
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RW_AWS_SECRET_ACCESS_KEY }}
109109
run: |
110-
python3 test/python/markdown_testing/markdown_testing.py --test-root=docs/walkthroughs/readwrite 2>&1 | tee cicd/log/markdown-readwrite-testing-results.log
110+
python3 test/python/markdown_testing/markdown_testing.py "$(pwd)" --test-root=docs/walkthroughs/readwrite 2>&1 | tee cicd/log/markdown-readwrite-testing-results.log
111111
112112
- name: Run Deploy Walkthrough Scenarios
113113
if: ${{ env.runType == env.RUNTYPE_DEPLOY || env.runType == env.RUNTYPE_ALL }}
114114
env:
115115
AWS_ACCESS_KEY_ID: ${{ secrets.CI_SCENARIO_RW_AWS_ACCESS_KEY_ID }}
116116
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_SCENARIO_RW_AWS_SECRET_ACCESS_KEY }}
117117
run: |
118-
python3 test/python/markdown_testing/markdown_testing.py --test-root=docs/walkthroughs/deploy 2>&1 | tee cicd/log/markdown-deploy-testing-results.log
118+
python3 test/python/markdown_testing/markdown_testing.py "$(pwd)" --test-root=docs/walkthroughs/deploy 2>&1 | tee cicd/log/markdown-deploy-testing-results.log
119119
120120
- name: Upload Test Results
121121
uses: actions/[email protected]

0 commit comments

Comments
 (0)