Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to run tests on every commit to every pull request, while also allowing manual running. #1414

Merged
merged 12 commits into from
May 8, 2024
4 changes: 2 additions & 2 deletions .github/workflows/build_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
build_master:
build_version:
name: Build branch
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install chart-releaser
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: run_tests
on: workflow_dispatch
on:
pull_request:
branches:
- '*'
workflow_dispatch:
jobs:
run_tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache python
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-python
with:
path: ~/venv/qa
Expand All @@ -32,15 +36,30 @@ jobs:
with:
driver: docker
container-runtime: containerd
kubernetes-version: v1.25.3
kubernetes-version: v1.30.0
cpus: max
memory: max

- name: Build clickhouse-operator locally without push to registry
run: |
minikube status
export CHO_RELEASE=$(cat release)
echo "current release=$CHO_RELEASE"

docker build -f dockerfile/operator/Dockerfile -t altinity/clickhouse-operator:${CHO_RELEASE} --pull .
docker build -f dockerfile/metrics-exporter/Dockerfile -t altinity/metrics-exporter:${CHO_RELEASE} --pull .

docker image save altinity/clickhouse-operator:${CHO_RELEASE} -o operator.tar
docker image save altinity/metrics-exporter:${CHO_RELEASE} -o metrics-exporter.tar

minikube image load operator.tar
minikube image load metrics-exporter.tar

- name: Run Tests
run: |
source ~/venv/qa/bin/activate
set -x

# bash -xe ./deploy/prometheus/create-prometheus.sh
# bash -xe ./deploy/minio/install-minio-operator.sh
# bash -xe ./deploy/minio/install-minio-tenant.sh
Expand All @@ -54,14 +73,15 @@ jobs:
# bash ./tests/e2e/run_tests_parallel.sh
sudo ln -snvf ~/venv/qa/bin/tfs /bin/tfs
ONLY='*'
# ONLY='*test_036*'
# ONLY='*test_008_2*'

~/venv/qa/bin/python3 ./tests/regression.py --only "/regression/e2e.test_operator/${ONLY}" --trim-results on --debug --native --log ./tests/raw.log
~/venv/qa/bin/tfs --debug --no-colors transform compact ./tests/raw.log ./tests/compact.log
~/venv/qa/bin/tfs --debug --no-colors transform nice ./tests/raw.log ./tests/nice.log.txt
~/venv/qa/bin/tfs --debug --no-colors transform short ./tests/raw.log ./tests/short.log.txt
~/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

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: testflows-logs
path: |
Expand All @@ -70,7 +90,7 @@ jobs:
if-no-files-found: error
retention-days: 7

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: testflows-report
path: |
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,7 @@ def run_insert_query(self, host, user, password, query, trigger_event, shell=Non
if res == "":
ok += 1
else:
note(f"WTF res={res}")
errors += 1
with By(f"{ok} inserts have been executed with no errors, {errors} inserts have failed"):
assert errors == 0
Expand Down