Skip to content

Commit 86ff3e9

Browse files
gcp-flask-migration (#480)
Summary: - Migrated `google` mocks from `mockserver` to `flask`. - Flask lifeccycle not well controlled by robot process lib keyword `Terminate All Processes kill=True`, so shell hack kills flask before robot repeats.
1 parent 1192ed0 commit 86ff3e9

Some content is hidden

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

43 files changed

+6569
-6668
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ jobs:
185185
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
186186
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
187187
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
188-
run: |
188+
run: | #Ideally there wiuld be forced kill of flaks here but dont know how to do that in windows
189189
python cicd/python/build.py --robot-test-integration
190190
191191
- name: Prepare Test DB
@@ -386,6 +386,9 @@ jobs:
386386
- name: Run robot mocked functional tests with aggressive concurrency
387387
if: success()
388388
run: |
389+
echo "## Stray flask apps to be killed before robot tests ##"
390+
pgrep -f flask | xargs kill -9
391+
echo "## End ##"
389392
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true", "CONCURRENCY_LIMIT": -1 } }'
390393
391394
- name: Output from mocked functional tests with aggressive concurrency
@@ -401,6 +404,9 @@ jobs:
401404
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
402405
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
403406
run: |
407+
echo "## Stray flask apps to be killed before robot tests ##"
408+
pgrep -f flask | xargs kill -9
409+
echo "## End ##"
404410
python cicd/python/build.py --robot-test-integration
405411
406412
- name: Prepare Test DB
@@ -443,6 +449,9 @@ jobs:
443449
cp stackql_${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}}_amd64.deb deb_test/
444450
sudo dpkg -i ./deb_test/stackql_${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}}_amd64.deb
445451
sudo apt-get install -f
452+
echo "## Stray flask apps to be killed before robot tests ##"
453+
pgrep -f flask | xargs kill -9
454+
echo "## End ##"
446455
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true", "CONCURRENCY_LIMIT": -1, "USE_STACKQL_PREINSTALLED": "true" } }'
447456
stackqlLocation="$(which stackql 2>&1 | head -n 1)"
448457
stackqlVersion="$(stackql --version 2>&1 | head -n 1)"
@@ -642,6 +651,9 @@ jobs:
642651
- name: Run robot mocked functional tests with aggressive concurrency
643652
if: success()
644653
run: |
654+
echo "## Stray flask apps to be killed before robot tests ##"
655+
pgrep -f flask | xargs kill -9
656+
echo "## End ##"
645657
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true", "CONCURRENCY_LIMIT": -1 } }'
646658
647659
- name: Output from mocked functional tests with aggressive concurrency
@@ -657,6 +669,9 @@ jobs:
657669
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
658670
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
659671
run: |
672+
echo "## Stray flask apps to be killed before robot tests ##"
673+
pgrep -f flask | xargs kill -9
674+
echo "## End ##"
660675
python cicd/python/build.py --robot-test-integration
661676
662677
- name: Prepare Test DB
@@ -726,6 +741,9 @@ jobs:
726741
cp "${DEB_FILE}" deb_test/
727742
sudo dpkg -i "./deb_test/${DEB_FILE}"
728743
sudo apt-get install -f
744+
echo "## Stray flask apps to be killed before robot tests ##"
745+
pgrep -f flask | xargs kill -9
746+
echo "## End ##"
729747
python cicd/python/build.py --robot-test --config='{ "variables": { "SHOULD_RUN_DOCKER_EXTERNAL_TESTS": "true", "CONCURRENCY_LIMIT": -1, "USE_STACKQL_PREINSTALLED": "true" } }'
730748
stackqlLocation="$(which stackql 2>&1 | head -n 1)"
731749
stackqlVersion="$(stackql --version 2>&1 | head -n 1)"
@@ -859,6 +877,9 @@ jobs:
859877
then
860878
export BUILDPATCHVERSION="${BUILDPATCHVERSION}"
861879
fi
880+
echo "## Stray flask apps to be killed before robot tests ##"
881+
pgrep -f flask | xargs kill -9
882+
echo "## End ##"
862883
python3 cicd/python/build.py --robot-test-integration --config='{ "variables": { "IS_WSL": true } }'
863884
864885
macosbuild:
@@ -985,6 +1006,9 @@ jobs:
9851006
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
9861007
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
9871008
run: |
1009+
echo "## Stray flask apps to be killed before robot tests ##"
1010+
pgrep -f flask | xargs kill -9
1011+
echo "## End ##"
9881012
python cicd/python/build.py --robot-test-integration
9891013
9901014
- name: Prepare Test DB
@@ -1246,6 +1270,9 @@ jobs:
12461270
if: success()
12471271
timeout-minutes: ${{ vars.DEFAULT_STEP_TIMEOUT_MIN == '' && 20 || vars.DEFAULT_STEP_TIMEOUT_MIN }}
12481272
run: |
1273+
echo "## Stray flask apps to be killed before robot tests ##"
1274+
pgrep -f flask | xargs kill -9
1275+
echo "## End ##"
12491276
echo "## Stray docker containers before postgres robot tests ##"
12501277
docker container ls --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}" -a
12511278
echo "## End ##"
@@ -1272,6 +1299,9 @@ jobs:
12721299
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
12731300
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
12741301
run: |
1302+
echo "## Stray flask apps to be killed before robot tests ##"
1303+
pgrep -f flask | xargs kill -9
1304+
echo "## End ##"
12751305
python cicd/python/build.py --robot-test-integration --config='{ "variables": { "EXECUTION_PLATFORM": "docker" } }'
12761306
12771307
- name: Login to Docker Hub

cicd/util/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
## Useful hacks
4+
5+
Robot struggles to kill flask servers, so `pgrep` can help:
6+
7+
```bash
8+
pgrep -f flask | xargs kill -9
9+
```

0 commit comments

Comments
 (0)