Use shared server and unique indices for add_documents IT tests

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
This commit is contained in:
Martin Tzvetanov Grigorov 2025-05-26 11:28:23 +03:00
parent cf5d26124a
commit fc88b003b4
No known key found for this signature in database
GPG key ID: 3194FD8C1AE300EF
5 changed files with 243 additions and 213 deletions

View file

@ -126,7 +126,7 @@ pub enum Error {
#[error(transparent)]
Heed(#[from] heed::Error),
#[error("{}", match .index_uid {
Some(uid) if !uid.is_empty() => format!("Index `{}`: {error}", uid),
Some(uid) if !uid.is_empty() => format!("Index `{}`: {error}", Error::index_name(uid)),
_ => format!("{error}")
})]
Milli { error: milli::Error, index_uid: Option<String> },
@ -177,6 +177,18 @@ pub enum Error {
PlannedFailure,
}
impl Error {
#[inline]
fn index_name(index_name: &str) -> &str {
if let Ok(_) = uuid::Uuid::parse_str(index_name) {
"[uuid]"
} else {
index_name
}
}
}
#[derive(Debug, thiserror::Error)]
#[error(
"{disabled_action} requires enabling the `{feature}` experimental feature. See {issue_link}"

View file

@ -33,6 +33,7 @@ pub fn default_snapshot_settings_for_test<'a>(
let filename = path.file_name().unwrap().to_str().unwrap();
settings.set_omit_expression(true);
<<<<<<< HEAD
fn uuid_in_message_redaction(content: Content, _content_path: ContentPath) -> Content {
match &content {
Content::String(s) => {
@ -45,6 +46,15 @@ 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,
}
});
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