Skip to content

feat: rebuild ch_diag diagnostics engine #1

feat: rebuild ch_diag diagnostics engine

feat: rebuild ch_diag diagnostics engine #1

Workflow file for this run

name: tests
on:
push:
pull_request:
permissions:
contents: read
jobs:
python:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install -e '.[dev]'
- run: python -m compileall -q ch_diag tools tests
- run: ruff check ch_diag tests tools
- run: python tools/normalize_sql_outputs.py --check
- run: ch-diag validate
- run: pytest -q
- run: python -m build
browser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install -e '.[test,browser]'
- run: python -m playwright install --with-deps chromium
- run: pytest -q -m browser tests/browser
clean-wheel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install build
- run: python -m build
- name: Install only the wheel in a clean Python 3.10 container
run: >-
docker run --rm
--volume "${PWD}:/src:ro"
--workdir /tmp
python:3.10-slim
sh -ec 'python -m pip install /src/dist/ch_diag-*.whl;
ch-diag validate;
ch-diag item-id-list >/tmp/items.tsv;
test -s /tmp/items.tsv;
python -c "import ch_diag; print(ch_diag.__version__)"'
clickhouse-25-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install -e '.[dev]'
- run: mkdir -p tests/integration/docker/state
- run: ssh-keygen -q -t ed25519 -N '' -f tests/integration/docker/state/id_ed25519
- run: cp tests/integration/docker/state/id_ed25519.pub tests/integration/docker/state/authorized_keys
- run: docker compose -f tests/integration/docker/compose.yaml up -d --build
- name: Wait for ClickHouse
run: |
for attempt in $(seq 1 60); do
if docker exec chdiag-test-25-8 clickhouse-client --query 'SELECT 1'; then
exit 0
fi
sleep 2
done
docker logs chdiag-test-25-8
exit 1
- name: Export test TLS trust anchor
run: docker cp chdiag-test-25-8:/etc/clickhouse-server/tls/server.crt tests/integration/docker/state/server.crt
- run: ssh-keyscan -p 12222 127.0.0.1 > tests/integration/docker/state/known_hosts
- run: >-
CH_DIAG_TEST_HOST=127.0.0.1
CH_DIAG_TEST_PORT=19001
CH_DIAG_TEST_CLUSTER=chdiag_test
CH_DIAG_TEST_TLS_PORT=19440
CH_DIAG_TEST_TLS_CA=tests/integration/docker/state/server.crt
CH_DIAG_TEST_SSH_KEY=tests/integration/docker/state/id_ed25519
CH_DIAG_TEST_SSH_KNOWN_HOSTS=tests/integration/docker/state/known_hosts
pytest -q -m integration tests/integration/test_live_clickhouse.py
- name: SSH one-shot smoke
run: |
ch-diag one-shot \
--host 127.0.0.1 --port 9000 \
--collection-mode remote --target-scope node \
--ssh-host 127.0.0.1 --ssh-port 12222 --ssh-user chdiag \
--ssh-key tests/integration/docker/state/id_ed25519 \
--ssh-known-hosts tests/integration/docker/state/known_hosts \
--item-id overview.server,operating_system.os_release \
--output-format json --out-dir reports/ssh
- name: SSH snapshots smoke
run: |
ch-diag snapshots \
--host 127.0.0.1 --port 9000 \
--collection-mode remote --target-scope node \
--ssh-host 127.0.0.1 --ssh-port 12222 --ssh-user chdiag \
--ssh-key tests/integration/docker/state/id_ed25519 \
--ssh-known-hosts tests/integration/docker/state/known_hosts \
--item-id snapshot_charts_os.os_cpu_utilization,snapshot_charts_clickhouse.query_rate \
--duration 0.4 --interval 0.2 \
--output-format json --out-dir reports/ssh-snapshots
clickhouse-legacy:
name: ClickHouse legacy ${{ matrix.boundary }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
boundary: ['20.3', '20.11', '21.1', '21.4', '21.8', '21.11', '22.2']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- if: runner.arch == 'X64'
run: python -m pip install -e '.[test]'
- name: Run pinned legacy boundary
if: runner.arch == 'X64'
run: >-
python tools/run_legacy_clickhouse_matrix.py
--boundary '${{ matrix.boundary }}'
--remove
- name: Explain architecture skip
if: runner.arch != 'X64'
run: echo "Legacy ClickHouse images are linux/amd64 only; runner is ${{ runner.arch }}"
clickhouse-multinode-25-8:
name: ClickHouse 25.8 two replicas + Keeper
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: python -m pip install -e '.[test]'
- name: Build, seed and test the real cluster
run: python tools/run_multinode_clickhouse.py --remove