Replace pytest/tox test suite with BATS
The Python-based test infrastructure (pytest, tox, testinfra) is replaced with BATS (Bash Automated Testing System), matching the approach already used in FTL Changes: - Add test/run.sh — single entry point replacing all 15 tox.*.ini files; accepts DISTRO env var, builds the test image, installs BATS on demand, and selects test files based on distro family (debian/alpine/rhel) - Add test/helpers/mocks.bash — bash equivalents of conftest.py's mock_command*, mock_command_2, and mock_command_passthrough helpers; uses base64 transfer to write mock scripts into containers safely - Add test/test_automated_install.bats — replaces test_any_automated_install.py - Add test/test_utils.bats — replaces test_any_utils.py - Add test/test_selinux.bats — replaces test_centos_fedora_common_support.py; only run on CentOS/Fedora (rhel family) - Remove conftest.py, requirements.txt, setup.py, __init__.py - Remove all 15 tox.*.ini files - Remove all three Python test files - Update .github/workflows/test.yml: drop Python setup, tox invocation, and black formatting check; distro-test job now runs bash test/run.sh - Update .gitignore: remove Python-specific entries, add test/libs/ Signed-off-by: PromoFaux <PromoFaux@users.noreply.github.com> Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
32
.github/workflows/test.yml
vendored
32
.github/workflows/test.yml
vendored
@@ -7,11 +7,6 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
PYTHONUNBUFFERED: 1
|
||||
PYTHONUTF8: 1
|
||||
|
||||
jobs:
|
||||
smoke-tests:
|
||||
if: github.event.pull_request.draft == false
|
||||
@@ -25,18 +20,18 @@ jobs:
|
||||
- name: Check scripts in repository are executable
|
||||
run: |
|
||||
IFS=$'\n';
|
||||
for f in $(find . -name '*.sh'); do if [[ ! -x $f ]]; then echo "$f is not executable" && FAIL=1; fi ;done
|
||||
for f in $(find . -name '*.sh' -o -name '*.bats'); do if [[ ! -x $f ]]; then echo "$f is not executable" && FAIL=1; fi ;done
|
||||
unset IFS;
|
||||
# If FAIL is 1 then we fail.
|
||||
[[ $FAIL == 1 ]] && exit 1 || echo "Scripts are executable!"
|
||||
|
||||
- name: Differential ShellCheck
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: redhat-plumbers-in-action/differential-shellcheck@d965e66ec0b3b2f821f75c8eff9b12442d9a7d1e #v5.5.6
|
||||
with:
|
||||
severity: warning
|
||||
display-engine: sarif-fmt
|
||||
|
||||
|
||||
- name: Spell-Checking
|
||||
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 #v2.2
|
||||
with:
|
||||
@@ -48,12 +43,6 @@ jobs:
|
||||
- name: Run editorconfig-checker
|
||||
run: editorconfig-checker
|
||||
|
||||
- name: Check python code formatting with black
|
||||
uses: psf/black@c6755bb741b6481d6b3d3bb563c83fa060db96c9 #26.3.1
|
||||
with:
|
||||
src: "./test"
|
||||
options: "--check --diff --color"
|
||||
|
||||
distro-test:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ubuntu-latest
|
||||
@@ -79,22 +68,9 @@ jobs:
|
||||
alpine_3_22,
|
||||
alpine_3_23,
|
||||
]
|
||||
env:
|
||||
DISTRO: ${{matrix.distro}}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install wheel
|
||||
run: pip install wheel
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r test/requirements.txt
|
||||
|
||||
- name: Test with tox
|
||||
run: tox -c test/tox.${DISTRO}.ini
|
||||
- name: Run BATS test suite for ${{ matrix.distro }}
|
||||
run: DISTRO=${{ matrix.distro }} bash test/run.sh
|
||||
|
||||
Reference in New Issue
Block a user