mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 12:26:37 +00:00
test: prune redundant cases and add high-risk coverage across crates (#4208)
Remove or consolidate 57 test cases that cannot catch regressions (literal-constant asserts, construct-then-assert, derived-serde round-trips, near-duplicate env/getter matrices) in common, config, iam, madmin, and object-capacity, keeping all wire-format and error-path guards. Add 13 tests for previously uncovered high-risk behavior: filemeta version-sort determinism and merge resilience to garbage headers, zip extraction path-traversal rejection and exact limit boundaries, JWT tampered-signature rejection, and the bytes variant of dual-key (rustfs/minio) metadata fallback and precedence. Test-only change; no production code touched. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2597,13 +2597,6 @@ mod tests {
|
||||
assert_eq!(sys.sync_failures.load(Ordering::Relaxed), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iam_format_new_version_1() {
|
||||
let format = IAMFormat::new_version_1();
|
||||
assert_eq!(format.version, IAM_FORMAT_VERSION_1);
|
||||
assert_eq!(format.version, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_iam_format_file_path() {
|
||||
let path = get_iam_format_file_path();
|
||||
@@ -2717,26 +2710,6 @@ mod tests {
|
||||
assert!(policy.statements.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_constants() {
|
||||
// Test that constants are properly defined
|
||||
assert_eq!(IAM_FORMAT_FILE, "format.json");
|
||||
assert_eq!(IAM_FORMAT_VERSION_1, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iam_format_serialization() {
|
||||
let format = IAMFormat::new_version_1();
|
||||
|
||||
// Test serialization
|
||||
let serialized = serde_json::to_string(&format).unwrap();
|
||||
assert!(serialized.contains("\"version\":1"));
|
||||
|
||||
// Test deserialization
|
||||
let deserialized: IAMFormat = serde_json::from_str(&serialized).unwrap();
|
||||
assert_eq!(deserialized.version, format.version);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mapped_policy_operations() {
|
||||
let policy_name = "test-policy";
|
||||
|
||||
Reference in New Issue
Block a user