1
1
name : 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
3
18
jobs :
4
19
run_tests :
5
20
name : Run Tests
6
21
runs-on : ubuntu-latest
7
22
steps :
8
- - uses : actions/checkout@v3
23
+ - uses : actions/checkout@v4
9
24
- name : Cache python
10
- uses : actions/cache@v3
25
+ uses : actions/cache@v4
11
26
id : cache-python
12
27
with :
13
28
path : ~/venv/qa
@@ -32,36 +47,58 @@ jobs:
32
47
with :
33
48
driver : docker
34
49
container-runtime : containerd
35
- kubernetes-version : v1.25.3
50
+ kubernetes-version : v1.30.0
36
51
cpus : max
37
52
memory : max
38
53
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
+
39
69
- name : Run Tests
70
+ id : run-tests
71
+ continue-on-error : true
40
72
run : |
41
73
source ~/venv/qa/bin/activate
42
74
set -x
75
+ set +e # disable the "exit on failure"
43
76
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
47
78
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
53
85
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
65
102
with :
66
103
name : testflows-logs
67
104
path : |
@@ -70,10 +107,17 @@ jobs:
70
107
if-no-files-found : error
71
108
retention-days : 7
72
109
73
- - uses : actions/upload-artifact@v3
110
+ - uses : actions/upload-artifact@v4
74
111
with :
75
112
name : testflows-report
76
113
path : |
77
114
tests/report.html
78
115
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