mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
bats-core parallelises tests within a file when --jobs > 1. ses.bats and s3-notifications.bats share state across tests via setup_file/ teardown_file. In ses.bats this races "verify identities deleted" against the delete calls, producing an intermittent failure that blocked merges across recent PRs (#570, #576, #580). Pass --no-parallelize-within-files to keep parallelism across files (where tests are independent) while serialising within files. The --jobs 4 speedup is preserved since total runtime is bottlenecked by total-tests / jobs regardless of within-file scheduling. Verified locally: 20/20 pass with the flag, 4/10 pass without.
23 lines
731 B
Bash
23 lines
731 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
report_dir="$(mktemp -d /tmp/bats-junit-XXXXXX)"
|
|
trap 'rm -rf "$report_dir"' EXIT
|
|
|
|
set +e
|
|
# --no-parallelize-within-files: bats-core defaults to running tests in parallel
|
|
# both across files and within a file when --jobs > 1. Several tests in this
|
|
# suite share state across tests in the same file via setup_file/teardown_file
|
|
# (e.g. ses.bats, s3-notifications.bats), which races ordering-dependent tests.
|
|
# Cross-file parallelism is preserved.
|
|
/opt/bats-core/bin/bats --jobs 4 --no-parallelize-within-files \
|
|
--report-formatter junit -o "$report_dir" test/
|
|
status=$?
|
|
set -e
|
|
|
|
if [ -f "$report_dir/report.xml" ]; then
|
|
mv "$report_dir/report.xml" /results/junit.xml
|
|
fi
|
|
|
|
exit "$status"
|