Merge pull request #5574 from martin-g/faster-add_documents-it-tests

perf: Faster integration tests for add_documents.rs
This commit is contained in:
Tamo 2025-05-28 13:13:38 +00:00 committed by GitHub
commit c8e77b5f25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 416 additions and 395 deletions

View file

@ -16,6 +16,4 @@ insta = { version = "=1.39.0", features = ["json", "redactions"] }
md5 = "0.7.0"
once_cell = "1.20"
regex-lite = "0.1.6"
[dev-dependencies]
uuid = { version = "1.17.0", features = ["v4"] }

View file

@ -45,6 +45,21 @@ pub fn default_snapshot_settings_for_test<'a>(
settings.add_dynamic_redaction(".message", uuid_in_message_redaction);
settings.add_dynamic_redaction(".error.message", uuid_in_message_redaction);
settings.add_dynamic_redaction(".indexUid", |content, _content_path| match &content {
Content::String(s) => match uuid::Uuid::parse_str(s) {
Ok(_) => Content::String("[uuid]".to_owned()),
Err(_) => content,
},
_ => content,
});
settings.add_dynamic_redaction(".error.message", |content, _content_path| match &content {
Content::String(s) => {
let uuid_replaced = UUID_IN_MESSAGE_RE.replace_all(s, "$before[uuid]$after");
Content::String(uuid_replaced.to_string())
}
_ => content,
});
let test_name = test_name.strip_suffix("::{{closure}}").unwrap_or(test_name);
let test_name = test_name.rsplit("::").next().unwrap().to_owned();

View file

@ -116,7 +116,7 @@ utoipa-scalar = { version = "0.3.0", optional = true, features = ["actix-web"] }
actix-rt = "2.10.0"
brotli = "6.0.0"
# fixed version due to format breakages in v1.40
insta = "=1.39.0"
insta = { version = "=1.39.0", features = ["redactions"] }
manifest-dir-macros = "0.1.18"
maplit = "1.0.2"
meili-snap = { path = "../meili-snap" }

File diff suppressed because it is too large Load diff