Skip to content

Commit

Permalink
test: fix test_assembler to support parallel runs and run in parallel
Browse files Browse the repository at this point in the history
The `test_assembler.py` hardcods some filesystem and partition
UUIDs. This leads to hard to diagnose test failures when the
test is run in parallel. The btrfs and xfs filesystem drivers
will see the same uuid for multi created images and error sometimes with
someting like:
```
Mar 06 10:22:54 top kernel: BTRFS error: device /dev/loop104 belongs to fsid aff010e9-df95-4f81-be6b-e22317251033, and the fs is already mounted, scanned by mount (123856)
```
Its a race that only happens when two images are checked at the
same time.

This commit fixes the issue by just using a randomized UUID in
the test_assemblers.py. It also re-enables running the test in
parallel (which make it run a lot faster, from 34min to 14min).
  • Loading branch information
mvo5 authored and ochosi committed Mar 6, 2024
1 parent 8763687 commit 1278e5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
with:
image: ghcr.io/osbuild/osbuild-ci:latest-202308241910
run: |
# Using 4 workers is a bit arbitrary, "auto" is probably too
# aggressive.
export TEST_WORKERS="-n 4"
export OSBUILD_TEST_STORE=/var/tmp/osbuild-test-store
TEST_CATEGORY="test.run.test_assemblers" \
tox -e "py36"
7 changes: 4 additions & 3 deletions test/run/test_assemblers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import subprocess
import tempfile
from uuid import uuid4

import pytest

Expand Down Expand Up @@ -87,7 +88,7 @@ def test_rawfs(osbuild, fs_type):
pytest.skip(f"The {fs_type} was explicitly marked as unsupported on this platform.")
options = {
"filename": "image.raw",
"root_fs_uuid": "016a1cda-5182-4ab3-bf97-426b00b74eb0",
"root_fs_uuid": str(uuid4()),
"size": 1024 * MEBIBYTE,
"fs_type": fs_type,
}
Expand Down Expand Up @@ -165,8 +166,8 @@ def test_qemu(osbuild, fmt, fs_type):
options = {
"format": fmt,
"filename": f"image.{fmt}",
"ptuuid": "b2c09a39-db93-44c5-846a-81e06b1dc162",
"root_fs_uuid": "aff010e9-df95-4f81-be6b-e22317251033",
"ptuuid": str(uuid4()),
"root_fs_uuid": str(uuid4()),
"size": 1024 * MEBIBYTE,
"root_fs_type": fs_type,
}
Expand Down

0 comments on commit 1278e5d

Please sign in to comment.