Port xbstream_fifo_test.sh to pytest (xbstream_fifo_tests.py) - #12
Draft
saikumar-vs wants to merge 5 commits into
Draft
saikumar-vs wants to merge 5 commits into
saikumar-vs wants to merge 5 commits into
Conversation
saikumar-vs
marked this pull request as draft
September 22, 2026 10:01
Adds FIFO-streamed cloud backup coverage to the Python test framework, following the conventions of innodb_myrocks_backup_tests.py and inc_backup_load_tests.py: - test_helper.py: additive FIFO_STREAM/FIFO_DIR constants and six new BackupTestHelper methods (take_fifo_backup_step, restore_fifo_backup_step, take_fifo_full_backup_and_restore, take_fifo_incremental_backup_and_restore, restore_datadir_from, cleanup_fifo_state). These stream xtrabackup/xbstream and xbcloud through named pipes as two concurrent processes (background + foreground), mirroring the bash script's xbcloud_put()/xbcloud_get(), rather than take_backup()'s "cloud" backup_type (a single shell pipe). No existing method was modified. - seaweedfs_helper.py: new SeaweedFSHelper class managing the local SeaweedFS S3-gateway docker container, ported from the already-fixed xbstream_fifo_test.sh start_seaweedfs()/cleanup_exit() shell logic (percona-qa/server-qa PR #11). - xbstream_fifo_tests.py: the actual test file, with a session-scoped seaweedfs fixture and 7 tests mirroring the bash script's scenarios (full, incremental, compressed, partition-table, keyring_file, keyring_kmip, xbcrypt-encrypted backup). - README.md: new section documenting env vars, how to run, and the test reference table, matching the existing per-file structure. Verified end-to-end against real PXB 8.4.0-7 / PS 8.4.10-10 builds and a live SeaweedFS container: all 7 tests pass (test_fifo_kmip_backup requires KMIP vault/license resources not available in this environment, so it wasn't run, matching the same gap noted in the bash-script PR). One transient SeaweedFS-readiness timeout and one missing --xtrabackup-plugin-dir in two tests' prepare_params were found and fixed during that verification. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
hashicorp was commented out of KMIP_CONFIGS/DEFAULT_KMIP_CONFIGS and, even if enabled, KMIPHelper.setup_hashicorp() executed the downloaded hashicorp_kmip_setup.py (a real Python script, #!/usr/bin/env python3, argparse-based) via `bash -s`, which would have failed immediately with a syntax error. Fixed to invoke it via `python3 -`, matching how the retired bash kmip_helper.sh ran it. Enabling hashicorp in the shared KMIP_CONFIGS adds a `[hashicorp]` parametrized variant to every vault_type-parametrized test that reads from it (test_fifo_kmip_backup here, plus the existing test_kmip_component_backup and test_crash_backup_encrypted_kmip in inc_backup_load_tests.py). Added a VAULT_LICENSE environment-variable guard (pytest.skip when unset) at each of those three call sites, matching the existing FORTANIX_EMAIL/PASSWORD guard pattern, since hashicorp_kmip_setup.py requires a real HashiCorp Vault Enterprise license. Verified: xbstream_fifo_tests.py::test_fifo_kmip_backup[hashicorp] skips cleanly (no VAULT_LICENSE in this environment) instead of failing; full license-driven setup path still needs a real Vault Enterprise license to verify end-to-end, same limitation noted for the bash script in PR #11. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Unifies the license env var name to HASHICORP_VAULT_LICENSE across hashicorp_kmip_setup.py's check_license() and the three pytest skip-guard sites (test_helper.py's run_kmip_component_backup/ run_crash_tests_pstress_encrypted, xbstream_fifo_tests.py's test_fifo_kmip_backup). Fortanix's env vars (FORTANIX_EMAIL/PASSWORD) are left as-is. Left untouched: the `-e VAULT_LICENSE=...` passed into the Vault Enterprise docker container itself (hashicorp_kmip_setup.py:142) -- that's HashiCorp Vault's own required container env var name, not something under our control, and renaming it would break Vault's license detection. Also documents HASHICORP_VAULT_LICENSE in README.md alongside the existing FORTANIX_EMAIL/PASSWORD guidance for all three affected tests. Verified: xbstream_fifo_tests.py::test_fifo_kmip_backup[hashicorp] still skips cleanly under the new env var name. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Updated KMIPHelper to store error messages in `self.last_error` for empty script downloads and execution failures, improving error reporting. - Modified SeaweedFSHelper to capture and report errors when starting the SeaweedFS container, providing clearer feedback on failures. These changes improve the robustness and clarity of error handling in the respective helper classes.
- xbcloud_put_fifo -> take_backup_fifo: it drives xtrabackup --backup itself (not just an upload like xbcloud_put), so it belongs with the existing take_full_backup/take_incremental_backup naming instead of being named after the xbcloud subcommand it happens to also call. - take_fifo_full_backup_and_restore -> take_full_backup_fifo - take_fifo_incremental_backup_and_restore -> take_incremental_backup_fifo Both drop the "_and_restore" suffix to match take_full_backup/ take_incremental_backup, which already restore internally without saying so in the name, and move "fifo" to a consistent suffix position shared with take_backup_fifo/xbcloud_get(use_fifo=...). xbcloud_get's use_fifo flag is left as-is: unlike the backup/put side, FIFO vs single-pipe on the get side is genuinely just a transport detail of the same "get a backup from cloud" operation, not a different one. Verified test_fifo_full_backup_and_restore and test_fifo_incremental_backup still pass end-to-end against real PXB 8.4.0-7/PS 8.4.10-10 builds and a live SeaweedFS container after the rename. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
saikumar-vs
force-pushed
the
pxb-xbstream-fifo-pytest-port
branch
from
September 22, 2026 15:12
0eea4f4 to
e230815
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports
xbstream_fifo_test.sh(the bash FIFO-streamed backup test, updated to use SeaweedFS in #11, now merged) to the Python/pytest framework, following the conventions ofinnodb_myrocks_backup_tests.pyandinc_backup_load_tests.py.test_helper.py—FIFO_STREAM/FIFO_DIRconstants and newBackupTestHelpermethods:take_backup_fifo(runsxtrabackup --backupin the background +xbcloud putin the foreground, both reading/writing the same named pipes),take_full_backup_fifo/take_incremental_backup_fifo(full and full+N-incremental orchestration, mirroring the bash script'sfull_backup_and_restore()/incremental_backup_and_restore()), andcleanup_fifo_state. These streamxtrabackup/xbstreamandxbcloudthrough named pipes as two concurrent processes — distinct fromtake_backup()'s existing"cloud"backup_type, which is a single shell pipe.Two existing methods were extended (not just added-to):
xbcloud_getgained ause_fifokeyword (defaultFalse, so existing callers are unaffected) that switches it from the single-pipexbcloud get | xbstream -xto the two-process FIFO form; andtake_backup()'s inline stop/move-datadir/copy-back/restart restore logic was factored out into a new sharedrestore_datadir_from()method (also used by the FIFO path), removing the duplication between the two.seaweedfs_helper.py(new) —SeaweedFSHelperclass managing the local SeaweedFS S3-gateway docker container, ported from thexbstream_fifo_test.shstart_seaweedfs()/cleanup_exit()shell logic merged in Replace MinIO with SeaweedFS in xbstream_fifo_test.sh, fix keyring_file bugs #11.xbstream_fifo_tests.py(new) — the test file itself: a session-scopedseaweedfsfixture (starts the container once, stops it at session end) and 7 tests mirroring the bash script's scenarios (full, incremental, compressed, partition-table, keyring_file, keyring_kmip, xbcrypt-encrypted backup).README.md— new section documenting env vars, how to run, and the test reference table, matching the existing per-file structure.kmip_helper.py/test_helper.py/hashicorp_kmip_setup.py— enabled thehashicorpKMIP vault type (was commented out ofKMIP_CONFIGS/DEFAULT_KMIP_CONFIGS, and even if enabled,setup_hashicorp()was invoking the downloaded setup script viabashinstead ofpython3, which would have failed immediately). Added aHASHICORP_VAULT_LICENSEenv-var skip-guard everywhere the sharedKMIP_CONFIGSnow surfaces ahashicorpvariant (this file'stest_fifo_kmip_backup, plus the existingtest_kmip_component_backupandtest_crash_backup_encrypted_kmipininc_backup_load_tests.py), matching the existingFORTANIX_EMAIL/FORTANIX_PASSWORDguard pattern.kmip_helper.py(setup_hashicorpnow recordsself.last_errorfor empty-download/exec failures) andseaweedfs_helper.py(start()now checks and reportsdocker start's exit code instead of ignoring it); also fixed anor FIFO_STREAM/or FIFO_DIRpattern intest_helper.pythat would have silently overridden an explicitfifo_streams=0/fifo_dir=""with the default (should only fall back onNone).main(post-Replace MinIO with SeaweedFS in xbstream_fifo_test.sh, fix keyring_file bugs #11) so this PR's diff no longer shows against a stale base.Test plan
Verified end-to-end against real PXB 8.4.0-7 / PS 8.4.10-10 builds and a live SeaweedFS container:
test_fifo_full_backup_and_restoretest_fifo_incremental_backuptest_fifo_compressed_backup(confirmed real zstd compression in the backup log)test_fifo_partition_tablestest_fifo_keyring_file_backuptest_fifo_encrypted_backuptest_fifo_kmip_backup[pykmip]— run 3 times: passed, then hit a genuinextrabackup --prepareSIGSEGV crash (__printf_buffer/__vsnprintf_internal), then passed again. Non-deterministic and reproducible independently of this port's code — a product-level PXB 8.4.0-7 stability issue during prepare of an encrypted (keyring_kmip) backup, in the same general class as the separately-notedkeyring_fileInnoDB-assertion crash. Worth its own PXB bug report; not something this PR can fix.test_fifo_kmip_backup[fortanix]/[hashicorp]— confirmed both skip cleanly withoutFORTANIX_EMAIL/FORTANIX_PASSWORD/HASHICORP_VAULT_LICENSEset (neither available in this environment; the credential/license-driven setup paths themselves are unverified end-to-end)take_full_backup_fifo/take_incremental_backup_fifo/take_backup_fifoafter the method renaming and thexbcloud_get/restore_datadir_fromconsolidation (full + incremental FIFO backups still pass)Regression-checked:
innodb_myrocks_backup_tests.pyandinc_backup_load_tests.pystill collect cleanly (72 tests total across all three files).🤖 Generated with Claude Code