More fixes of the tests

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
This commit is contained in:
Martin Tzvetanov Grigorov 2025-06-10 16:58:48 +03:00
parent 1824fbd1b5
commit 6a683975bf
No known key found for this signature in database
GPG Key ID: 3194FD8C1AE300EF
3 changed files with 333 additions and 314 deletions

View File

@ -43,10 +43,30 @@ pub fn default_snapshot_settings_for_test<'a>(
} }
} }
fn uuid_in_json_key_redaction(content: Content, _content_path: ContentPath) -> Content {
match content {
Content::Map(map) => {
let new_map = map.iter()
.map(|(key, value)| {
match key {
Content::String(s) => {
let uuid_replaced = UUID_IN_MESSAGE_RE.replace_all(s, "[uuid]");
(Content::String(uuid_replaced.to_string()), value.clone())
}
_ => (key.clone(), value.clone()),
}
}).collect();
Content::Map(new_map)
}
_ => content,
}
}
settings.add_dynamic_redaction(".message", uuid_in_message_redaction); settings.add_dynamic_redaction(".message", uuid_in_message_redaction);
settings.add_dynamic_redaction(".**.message", uuid_in_message_redaction); settings.add_dynamic_redaction(".**.message", uuid_in_message_redaction);
settings.add_dynamic_redaction(".indexUid", uuid_in_message_redaction); settings.add_dynamic_redaction(".indexUid", uuid_in_message_redaction);
settings.add_dynamic_redaction(".**.indexUid", uuid_in_message_redaction); settings.add_dynamic_redaction(".**.indexUid", uuid_in_message_redaction);
settings.add_dynamic_redaction(".facetsByIndex", uuid_in_json_key_redaction);
let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name); let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name);
let test_name = test_name.rsplit("::").next().unwrap().to_owned(); let test_name = test_name.rsplit("::").next().unwrap().to_owned();

View File

@ -350,7 +350,7 @@ impl<State> Server<State> {
pub fn unique_index_with_prefix(&self, prefix: &str) -> Index<'_> { pub fn unique_index_with_prefix(&self, prefix: &str) -> Index<'_> {
let uuid = Uuid::new_v4(); let uuid = Uuid::new_v4();
Index { Index {
uid: format!("{prefix}-{}", uuid.to_string()), uid: format!("{prefix}-{}", uuid),
service: &self.service, service: &self.service,
encoder: Encoder::Plain, encoder: Encoder::Plain,
marker: PhantomData, marker: PhantomData,

File diff suppressed because it is too large Load Diff