test(storage): compare resource-free conditions without the clock keys

`resource_free_conditions_read_the_same_client_through_both_forms`
compared two condition maps read at different instants, so
`CurrentTime` (and, across a second boundary, `EpochTime`) differed
between the legacy and the owned read, and the test failed. Both clock
keys are now removed before the comparison. Every request-derived key
must still match, and `SourceIp` is still pinned to its expected value.

This corrects a test introduced in 9c394af48.
This commit is contained in:
overtrue
2026-11-13 14:04:23 +08:00
parent c83f47871d
commit f33271a743
+12 -2
View File
@@ -422,8 +422,18 @@ fn resource_free_conditions_read_the_same_client_through_both_forms() {
),
] {
let envelope = RequestEnvelope::from_s3s(&req);
let legacy_conditions = resource_free_condition_values(&req, &cred);
assert_eq!(legacy_conditions, resource_free_condition_values(&envelope, &cred), "{name}");
// The clock values are read at each call; every request-derived value must match.
let without_clock = |mut conditions: HashMap<String, Vec<String>>| {
conditions.remove("CurrentTime");
conditions.remove("EpochTime");
conditions
};
let legacy_conditions = without_clock(resource_free_condition_values(&req, &cred));
assert_eq!(
legacy_conditions,
without_clock(resource_free_condition_values(&envelope, &cred)),
"{name}"
);
assert_eq!(source_ip(&legacy_conditions), expected, "{name}");
}
}