11name : run_tests
2- on : workflow_dispatch
2+ on :
3+ pull_request :
4+ branches :
5+ - ' *'
6+ workflow_dispatch :
7+ inputs :
8+ test_mode :
9+ description : ' Test mode'
10+ type : choice
11+ options :
12+ - Run all
13+ - Fail fast
14+ test_mask :
15+ description : ' Wildcard mask to run only some tests. Empty means all.'
16+ type : string
17+ required : false
318jobs :
419 run_tests :
520 name : Run Tests
621 runs-on : ubuntu-latest
722 steps :
8- - uses : actions/checkout@v3
23+ - uses : actions/checkout@v4
924 - name : Cache python
10- uses : actions/cache@v3
25+ uses : actions/cache@v4
1126 id : cache-python
1227 with :
1328 path : ~/venv/qa
@@ -32,36 +47,58 @@ jobs:
3247 with :
3348 driver : docker
3449 container-runtime : containerd
35- kubernetes-version : v1.25.3
50+ kubernetes-version : v1.30.0
3651 cpus : max
3752 memory : max
3853
54+ - name : Build clickhouse-operator locally without push to registry
55+ run : |
56+ minikube status
57+ export CHO_RELEASE=$(cat release)
58+ echo "current release=$CHO_RELEASE"
59+
60+ docker build -f dockerfile/operator/Dockerfile -t altinity/clickhouse-operator:${CHO_RELEASE} --pull .
61+ docker build -f dockerfile/metrics-exporter/Dockerfile -t altinity/metrics-exporter:${CHO_RELEASE} --pull .
62+
63+ docker image save altinity/clickhouse-operator:${CHO_RELEASE} -o operator.tar
64+ docker image save altinity/metrics-exporter:${CHO_RELEASE} -o metrics-exporter.tar
65+
66+ minikube image load operator.tar
67+ minikube image load metrics-exporter.tar
68+
3969 - name : Run Tests
70+ id : run-tests
71+ continue-on-error : true
4072 run : |
4173 source ~/venv/qa/bin/activate
4274 set -x
75+ set +e # disable the "exit on failure"
4376
44- # bash -xe ./deploy/prometheus/create-prometheus.sh
45- # bash -xe ./deploy/minio/install-minio-operator.sh
46- # bash -xe ./deploy/minio/install-minio-tenant.sh
77+ sudo ln -snvf ~/venv/qa/bin/tfs /bin/tfs
4778
48- # bash -xe /deploy/grafana/grafana-with-grafana-operator/install-grafana-operator.sh
49- # bash -xe /deploy/grafana/grafana-with-grafana-operator/install-grafana-with-operator.sh
50-
51- # docker compose -f ./tests/docker-compose/docker-compose.yml pull runner
52- # ~/venv/qa/bin/python3 ./tests/regression.py --only "/regression/e2e.test_operator/*" --trim-results on --debug --log ./tests/raw.log
79+ if [[ "${{ github.event.inputs.test_mask }}" != '' ]]
80+ then
81+ ONLY="${{ github.event.inputs.test_mask }}"
82+ else
83+ ONLY="*"
84+ fi
5385
54- # bash ./tests/e2e/run_tests_parallel.sh
55- sudo ln -snvf ~/venv/qa/bin/tfs /bin/tfs
56- ONLY='*'
57- # ONLY='*test_036*'
58- ~/venv/qa/bin/python3 ./tests/regression.py --only "/regression/e2e.test_operator/${ONLY}" --trim-results on --debug --native --log ./tests/raw.log
59- ~/venv/qa/bin/tfs --debug --no-colors transform compact ./tests/raw.log ./tests/compact.log
60- ~/venv/qa/bin/tfs --debug --no-colors transform nice ./tests/raw.log ./tests/nice.log.txt
61- ~/venv/qa/bin/tfs --debug --no-colors transform short ./tests/raw.log ./tests/short.log.txt
62- ~/venv/qa/bin/tfs --debug --no-colors report results -a "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/" ./tests/raw.log - --confidential --copyright "Altinity LTD" --logo ./tests/altinity.png | ~/venv/qa/bin/tfs --debug --no-colors document convert > ./tests/report.html
63-
64- - uses : actions/upload-artifact@v3
86+ if [[ "${{ github.event.inputs.test_mode }}" == 'Run all' ]]
87+ then
88+ test_mode="--test-to-end"
89+ fi
90+
91+ ~/venv/qa/bin/python3 ./tests/regression.py --only=/regression/e2e.test_operator/${ONLY} $test_mode --trim-results on -o short --native --log ./tests/raw.log
92+ test_result=$?
93+ ~/venv/qa/bin/tfs --no-colors transform compact ./tests/raw.log ./tests/compact.log
94+ ~/venv/qa/bin/tfs --no-colors transform nice ./tests/raw.log ./tests/nice.log.txt
95+ ~/venv/qa/bin/tfs --no-colors transform short ./tests/raw.log ./tests/short.log.txt
96+ ~/venv/qa/bin/tfs --no-colors report results -a "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/" ./tests/raw.log - --confidential --copyright "Altinity Inc." --logo ./tests/altinity.png | ~/venv/qa/bin/tfs --debug --no-colors document convert > ./tests/report.html
97+
98+ echo "test_result=$test_result" >> $GITHUB_OUTPUT
99+ exit "$test_result"
100+
101+ - uses : actions/upload-artifact@v4
65102 with :
66103 name : testflows-logs
67104 path : |
@@ -70,10 +107,17 @@ jobs:
70107 if-no-files-found : error
71108 retention-days : 7
72109
73- - uses : actions/upload-artifact@v3
110+ - uses : actions/upload-artifact@v4
74111 with :
75112 name : testflows-report
76113 path : |
77114 tests/report.html
78115 if-no-files-found : error
79- retention-days : 7
116+ retention-days : 90
117+
118+ - name : Test Failed
119+ if : ${{ steps.vars.outputs.test_result != '0' }}
120+ uses : actions/github-script@v3
121+ with :
122+ script : |
123+ core.setFailed('Test suite has failures! Check test run status and logs.')
0 commit comments