From ca892e38f97c7136c1b1dcbb69eab7944173b209 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 18 Apr 2026 15:33:12 +0200 Subject: [PATCH 1/2] fix(parallel): enable parallel test execution on Alpine Linux Previous race conditions on Alpine were resolved by later parallel hardening work (8c7212d and follow-ups). Enable Alpine in `parallel::is_enabled`, update unit coverage, and add matrix CI jobs running `--parallel --simple` and `--parallel` against the Alpine container so regressions surface immediately. Closes #370 --- .github/workflows/tests.yml | 16 +++++++++++++--- CHANGELOG.md | 1 + src/parallel.sh | 3 ++- tests/unit/parallel_test.sh | 11 +++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2122d9fa..96e82bff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -168,9 +168,19 @@ jobs: run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }} alpine: - name: "Alpine - latest" + name: "Alpine - ${{ matrix.name }}" runs-on: ubuntu-latest timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + include: + - name: "sequential" + command: "make test" + - name: "parallel simple" + command: "./bashunit --parallel --simple tests/" + - name: "parallel extended" + command: "./bashunit --parallel tests/" steps: - name: Checkout uses: actions/checkout@v4 @@ -184,7 +194,7 @@ jobs: run: | docker run --rm -v "$(pwd)":/project alpine:latest /bin/sh -c " \ apk update && \ - apk add --no-cache bash make git jq && \ + apk add --no-cache bash make git jq coreutils && \ adduser -D builder && \ chown -R builder /project && \ - su - builder -c 'cd /project; make test';" + su - builder -c 'cd /project; ${{ matrix.command }}';" diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db890c9..0fb99422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fix invalid `.env.example` coverage threshold entry and copy `.env.example` to `.env` in CI test workflows so configuration parse errors are caught during automated test runs - Fix `clock::now` shell-time parsing when `EPOCHREALTIME` uses a comma decimal separator - Fix LCOV and HTML coverage reports generating incomplete/empty output due to post-increment operator causing silent exit under `set -e` (#618) +- Enable parallel test execution on Alpine Linux; previously gated off due to race conditions, now resolved (#370) ## [0.34.1](https://github.com/TypedDevs/bashunit/compare/0.34.0...0.34.1) - 2026-03-20 diff --git a/src/parallel.sh b/src/parallel.sh index f3711f62..64666695 100755 --- a/src/parallel.sh +++ b/src/parallel.sh @@ -135,7 +135,8 @@ function bashunit::parallel::is_enabled() { "requested:$BASHUNIT_PARALLEL_RUN" "os:${_BASHUNIT_OS:-Unknown}" if bashunit::env::is_parallel_run_enabled && - (bashunit::check_os::is_macos || bashunit::check_os::is_ubuntu || bashunit::check_os::is_windows); then + (bashunit::check_os::is_macos || bashunit::check_os::is_ubuntu || + bashunit::check_os::is_alpine || bashunit::check_os::is_windows); then return 0 fi return 1 diff --git a/tests/unit/parallel_test.sh b/tests/unit/parallel_test.sh index 7265c950..fe23a5ae 100644 --- a/tests/unit/parallel_test.sh +++ b/tests/unit/parallel_test.sh @@ -77,6 +77,16 @@ function test_parallel_enabled_on_ubuntu() { bashunit::mock bashunit::check_os::is_windows mock_false bashunit::mock bashunit::check_os::is_macos mock_false bashunit::mock bashunit::check_os::is_ubuntu mock_true + bashunit::mock bashunit::check_os::is_alpine mock_false + + assert_successful_code "$(bashunit::parallel::is_enabled)" +} + +function test_parallel_enabled_on_alpine() { + bashunit::mock bashunit::check_os::is_windows mock_false + bashunit::mock bashunit::check_os::is_macos mock_false + bashunit::mock bashunit::check_os::is_ubuntu mock_false + bashunit::mock bashunit::check_os::is_alpine mock_true assert_successful_code "$(bashunit::parallel::is_enabled)" } @@ -93,6 +103,7 @@ function test_parallel_disabled_on_unsupported_os() { bashunit::mock bashunit::check_os::is_windows mock_false bashunit::mock bashunit::check_os::is_macos mock_false bashunit::mock bashunit::check_os::is_ubuntu mock_false + bashunit::mock bashunit::check_os::is_alpine mock_false assert_general_error "$(bashunit::parallel::is_enabled)" } From 77d135b8eaa1c14db36b42bbf0fe863fcc7ca8a8 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 18 Apr 2026 16:13:02 +0200 Subject: [PATCH 2/2] fix(ci): drop coreutils from alpine job to match previous baseline Busybox stat already supports `-c`, so installing coreutils is not required. Removing it also avoids exposing 7 extra acceptance tests that rely on a GNU environment and were previously skipped under busybox, which caused the upgrade test to break on Alpine CI. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96e82bff..c8947fba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -194,7 +194,7 @@ jobs: run: | docker run --rm -v "$(pwd)":/project alpine:latest /bin/sh -c " \ apk update && \ - apk add --no-cache bash make git jq coreutils && \ + apk add --no-cache bash make git jq && \ adduser -D builder && \ chown -R builder /project && \ su - builder -c 'cd /project; ${{ matrix.command }}';"