mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
56179210ab
* chore(deps): remove redundant dependency features Remove manifest feature entries that are implied by other requested features in the same dependency declaration. Verified that the resolved Cargo feature graph is unchanged after the cleanup. Co-Authored-By: heihutu <heihutu@gmail.com> * chore(deps): narrow tokio and reqwest features Co-Authored-By: heihutu <heihutu@gmail.com> --------- Co-authored-by: heihutu <heihutu@gmail.com>
rustfs-test-utils
Shared bootstrap helpers for RustFS integration tests (backlog#1153 infra-1).
Owns the "build a real temp-disk ECStore" setup that used to be copy-pasted
across the heal/iam/scanner integration tests and had already drifted.
Usage
// [dev-dependencies] rustfs-test-utils = { workspace = true }
use rustfs_test_utils::TestECStoreEnv;
let env = TestECStoreEnv::builder()
.prefix("rustfs_myfeature_test") // /tmp/<prefix>_<uuid>
.disk_count(4) // single pool, single set
.build()
.await;
env.make_bucket("my-bucket", /* versioned = */ true).await;
// env.ecstore : Arc<ECStore> — bootstrapped store
// env.disk_paths : Vec<PathBuf> — disk1..diskN for fault injection
// env.temp_root : PathBuf — root dir (leaked by design, see below)
Builder knobs:
disk_count(n)— disks in the single erasure set (default 4).prefix(&str)— temp-dir prefix; a uuid suffix keeps parallel nextest processes isolated.base_dir(path)— use a caller-owned directory (e.g.tempfile::TempDir) instead; the caller keeps cleanup ownership.init_bucket_metadata(bool)— runinit_bucket_metadata_sysafter boot (defaulttrue; the IAM bootstrap test opts out).
init_tracing() is exposed separately and is called by build().
The environment does not delete temp_root on drop: a failed test's
on-disk state stays inspectable, and heal tests keep manipulating
disk_paths after setup. Own the directory via base_dir if you want
automatic cleanup.
Constraints
- dev-dependency only. No crate may list
rustfs-test-utilsunder[dependencies]— test scaffolding must never reach production binaries. - Single-process integration scope. Multi-node / chaos harnesses are out
of scope (backlog#1100). Scanner's lifecycle tests are absorbed only after
ilm-1 activates them (they are
#[ignore]d today). - All
rustfs_ecstoreimports stay behindsrc/ecstore_test_compat.rs— the sanctioned test-compat boundary pattern enforced byscripts/check_architecture_migration_rules.sh. Extend that module, never import the facade directly from other files. - Tests using this env bind
127.0.0.1:0(random port) and unique temp dirs, so they stay parallel-safe under nextest's process-per-test model — do not add fixed ports or shared paths here. Seedocs/testing/README.mdfor the serial/nextest rules.