Skip to content

Commit 0279ec3

Browse files
authored
Merge pull request #1161 from Aiven-Open/jjaakola-aiven-collect-ci-logs
chore: collect test logs in CI
2 parents 9537ce3 + cb2a630 commit 0279ec3

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121
strategy:
2222
matrix:
2323
python-version: [ '3.10', '3.11', '3.12' ]
24-
env:
25-
PYTEST_ADDOPTS: >-
26-
--log-dir=/tmp/ci-logs
27-
--log-file=/tmp/ci-logs/pytest.log
28-
--showlocals
2924
steps:
3025
- uses: actions/checkout@v4
3126
# Need fetch-depth 0 to fetch tags, see https://github.com/actions/checkout/issues/701
@@ -76,7 +71,7 @@ jobs:
7671
RUNNER_UID: ${{ env.RUNNER_UID }}
7772
RUNNER_GID: ${{ env.RUNNER_GID }}
7873
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
79-
PYTEST_ARGS: "--cov=karapace --cov-append --numprocesses 4"
74+
PYTEST_ARGS: "--cov=karapace --cov-append --numprocesses 4 --log-file=/opt/test-tmp/test-logs/unit-tests-pytest.${{ matrix.python-version }}.log --showlocals"
8075

8176
- run: make e2e-tests-in-docker
8277
env:
@@ -85,7 +80,7 @@ jobs:
8580
RUNNER_UID: ${{ env.RUNNER_UID }}
8681
RUNNER_GID: ${{ env.RUNNER_GID }}
8782
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
88-
PYTEST_ARGS: "--cov=karapace --cov-append --numprocesses 4"
83+
PYTEST_ARGS: "--cov=karapace --cov-append --numprocesses 4 --basetemp /opt/test-tmp/e2e-test-logs --log-file=/opt/test-tmp/test-logs/e2e-tests-pytest.${{ matrix.python-version }}.log --showlocals"
8984

9085
- run: make integration-tests-in-docker
9186
env:
@@ -94,15 +89,19 @@ jobs:
9489
RUNNER_UID: ${{ env.RUNNER_UID }}
9590
RUNNER_GID: ${{ env.RUNNER_GID }}
9691
COVERAGE_FILE: "/opt/karapace/coverage/.coverage.${{ matrix.python-version }}"
97-
PYTEST_ARGS: "--cov=karapace --cov-append --random-order --numprocesses 4"
92+
PYTEST_ARGS: "--cov=karapace --cov-append --random-order --numprocesses 4 --basetemp /opt/test-tmp/integration-test-logs --log-file=/opt/test-tmp/test-logs/integration-tests-pytest.${{ matrix.python-version }}.log --showlocals"
93+
94+
- name: Allow reading of test temporary directory
95+
run: sudo chmod -R a+rX test-tmp.${{ matrix.python-version }}
9896

9997
- name: Archive logs
10098
uses: actions/upload-artifact@v4
10199
if: ${{ always() }}
102100
with:
103-
name: karapace-integration-test-logs-${{ matrix.python-version }}
104-
path: /tmp/ci-logs
105-
101+
name: karapace-test-logs-${{ matrix.python-version }}
102+
path: |
103+
test-tmp.${{ matrix.python-version }}
104+
!**/popen-*/**
106105
- name: Archive coverage file
107106
uses: actions/upload-artifact@v4
108107
with:

GNUmakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ stop-karapace-docker-resources:
113113
.PHONY: start-karapace-docker-resources
114114
start-karapace-docker-resources: export KARAPACE_VERSION ?= 4.1.1.dev44+gac20eeed.d20241205
115115
start-karapace-docker-resources:
116-
sudo touch .coverage.3.10 .coverage.3.11 .coverage.3.12
117-
sudo chown ${RUNNER_UID}:${RUNNER_GID} .coverage.3.10 .coverage.3.11 .coverage.3.12
116+
sudo touch .coverage.${PYTHON_VERSION}
117+
sudo chown ${RUNNER_UID}:${RUNNER_GID} .coverage.${PYTHON_VERSION}
118+
sudo mkdir -p test-tmp.${PYTHON_VERSION}
119+
sudo chown -R ${RUNNER_UID}:${RUNNER_GID} test-tmp.${PYTHON_VERSION}
118120
$(DOCKER_COMPOSE) -f container/compose.yml up -d --build --wait --detach
119121

120122
.PHONY: smoke-test-schema-registry

container/compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ services:
231231
- ../mypy.ini:/opt/karapace/mypy.ini
232232
- ../.pre-commit-config.yaml:/opt/karapace/.pre-commit-config.yaml
233233
- ../.coveragerc:/opt/karapace/.coveragerc
234-
- ../.coverage.3.10:/opt/karapace/coverage/.coverage.3.10
235-
- ../.coverage.3.11:/opt/karapace/coverage/.coverage.3.11
236-
- ../.coverage.3.12:/opt/karapace/coverage/.coverage.3.12
234+
- "../.coverage.$PYTHON_VERSION:/opt/karapace/coverage/.coverage.$PYTHON_VERSION"
235+
- "../test-tmp.$PYTHON_VERSION:/opt/test-tmp"
237236
environment:
238237
- COVERAGE_FILE
239238
- COVERAGE_RCFILE=/opt/karapace/.coveragerc

0 commit comments

Comments
 (0)