diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9987f6f8d..cd7dafab7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,5 +32,16 @@ jobs: with: image: ghcr.io/osbuild/osbuild-ci:latest-202308241910 run: | + # Note that only "test.run.test_stages" runs in parallel because + # the other tests are not sufficiently isolated and will cause + # random failures. But test_stages is the long running one with + # almost 2h. + if [ "${{ matrix.test }}" = "test.run.test_stages" ]; then + # Using 4 workers is a bit arbitrary, "auto" is probably too + # aggressive. + export TEST_WORKERS="-n 4" + # Share the store between the workers speeds things up further + export OSBUILD_TEST_STORE=/var/tmp/osbuild-test-store + fi TEST_CATEGORY="${{ matrix.test }}" \ tox -e "${{ matrix.environment }}" diff --git a/tox.ini b/tox.ini index 30b1b3b72..04da534e8 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ labels = description = "run osbuild unit tests" deps = pytest + pytest-xdist jsonschema mako iniparse @@ -26,7 +27,7 @@ passenv = TEST_CATEGORY commands = - bash -c 'python -m pytest --pyargs --rootdir=. {env:TEST_CATEGORY}' + bash -c 'python -m pytest --pyargs --rootdir=. {env:TEST_CATEGORY} {env:TEST_WORKERS}' allowlist_externals = bash