From 9435912a831011991738056483d9a7ada264cae8 Mon Sep 17 00:00:00 2001 From: cxymds Date: Wed, 4 Nov 2026 08:57:42 +0800 Subject: [PATCH 1/3] fix(test): make local VM execution portable --- .../environment-compatibility-tests.yml | 63 ++++++++ README.md | 24 +++ rustfs-replication-test.sh | 5 +- rustfs-table-test.sh | 84 ++++++---- rustfs-upgrade-test.sh | 7 +- rustfs_performance_test.sh | 14 +- scripts/check_execution_environment.py | 153 ++++++++++++++++++ scripts/lib/jq_nwise.jq | 5 + test_check_execution_environment.py | 62 +++++++ test_rustfs_performance_testing.py | 14 ++ test_rustfs_replication.py | 12 ++ test_rustfs_table.py | 28 ++++ 12 files changed, 434 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/environment-compatibility-tests.yml create mode 100644 scripts/check_execution_environment.py create mode 100644 scripts/lib/jq_nwise.jq create mode 100644 test_check_execution_environment.py create mode 100644 test_rustfs_table.py diff --git a/.github/workflows/environment-compatibility-tests.yml b/.github/workflows/environment-compatibility-tests.yml new file mode 100644 index 00000000..856f0a60 --- /dev/null +++ b/.github/workflows/environment-compatibility-tests.yml @@ -0,0 +1,63 @@ +name: Environment Compatibility Tests + +on: + pull_request: + paths: + - rustfs-table-test.sh + - rustfs-replication-test.sh + - rustfs-upgrade-test.sh + - rustfs_performance_test.sh + - scripts/check_execution_environment.py + - scripts/lib/** + - test_check_execution_environment.py + - test_rustfs_table.py + - test_rustfs_performance_testing.py + - test_rustfs_replication.py + - .github/workflows/environment-compatibility-tests.yml + push: + branches: [main] + paths: + - rustfs-table-test.sh + - rustfs-replication-test.sh + - rustfs-upgrade-test.sh + - rustfs_performance_test.sh + - scripts/check_execution_environment.py + - scripts/lib/** + - test_check_execution_environment.py + - test_rustfs_table.py + - test_rustfs_performance_testing.py + - test_rustfs_replication.py + - .github/workflows/environment-compatibility-tests.yml + +permissions: + contents: read + +jobs: + environment-compatibility: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a + with: + persist-credentials: false + - name: Validate shell syntax + run: >- + bash -n + rustfs-table-test.sh + rustfs-replication-test.sh + rustfs-upgrade-test.sh + rustfs_performance_test.sh + - name: Test portable execution helpers + run: >- + python3 -B -m unittest -v + test_check_execution_environment.py + test_rustfs_table.py + test_rustfs_performance_testing.py + test_rustfs_replication.py + - name: Test missing HOME + run: env -u HOME bash test_rustfs_pool_expand.sh + - name: Smoke-test environment preflight + run: >- + python3 scripts/check_execution_environment.py + --command bash + --minimum-bash-major 4 diff --git a/README.md b/README.md index faf00feb..e0df9ccd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,30 @@ # auto-testing Auto testing scripts +## Portable execution environments + +The suite defaults and CI topology remain unchanged. Local fleets can run the +read-only compatibility preflight before any mutation: + +```bash +python3 scripts/check_execution_environment.py \ + --command aws --command curl --command jq --command openssl --command ssh \ + --minimum-bash-major 4 \ + --check-aws-list-objects \ + --data-root /data/rustfs --drive-count 4 \ + --minimum-free-gib 40 --require-distinct-devices \ + --require-port 18080 +``` + +The command prints JSON and exits `2` when a requirement is blocked. It does +not create files, install packages, or change test behavior. A local VM that +maps separate data disks to `/data/rustfs1` through `/data/rustfs4` can remove +the root-filesystem disk-check bypass used by ad hoc single-disk deployments. + +The tier webhook receiver is configurable with `RUSTFS_RECEIVER_PORT`; choose a +port that does not conflict with the local package server or another service. +Scripts without an executable bit can be invoked with `bash