implement suggestions

This commit is contained in:
Timon Jurschitsch 2025-01-16 11:42:12 +01:00
parent a4ed36f0cc
commit 79d192fb3f
2 changed files with 10 additions and 11 deletions

View File

@ -899,7 +899,7 @@ fn create_and_list_index() {
index_scheduler.index("kefir").unwrap(); index_scheduler.index("kefir").unwrap();
let list = index_scheduler.get_paginated_indexes_stats(&AuthFilter::default(), 0, 20).unwrap(); let list = index_scheduler.get_paginated_indexes_stats(&AuthFilter::default(), 0, 20).unwrap();
snapshot!(json_string!(list, { "[1][0][1].created_at" => "[date]", "[1][0][1].updated_at" => "[date]" }), @r#" snapshot!(json_string!(list, { "[1][0][1].created_at" => "[date]", "[1][0][1].updated_at" => "[date]" }), @r###"
[ [
1, 1,
[ [
@ -907,8 +907,8 @@ fn create_and_list_index() {
"kefir", "kefir",
{ {
"number_of_documents": 0, "number_of_documents": 0,
"database_size": 24576, "database_size": 98304,
"used_database_size": 8192, "used_database_size": 32768,
"primary_key": null, "primary_key": null,
"field_distribution": {}, "field_distribution": {},
"created_at": "[date]", "created_at": "[date]",
@ -917,5 +917,5 @@ fn create_and_list_index() {
] ]
] ]
] ]
"#); "###);
} }

View File

@ -2,7 +2,7 @@ use crate::json;
use meili_snap::{json_string, snapshot}; use meili_snap::{json_string, snapshot};
use serde_json::Value; use serde_json::Value;
use crate::common::Server; use crate::common::{shared_does_not_exists_index, Server};
#[actix_rt::test] #[actix_rt::test]
async fn create_and_get_index() { async fn create_and_get_index() {
@ -26,13 +26,12 @@ async fn create_and_get_index() {
#[actix_rt::test] #[actix_rt::test]
async fn error_get_unexisting_index() { async fn error_get_unexisting_index() {
let server = Server::new_shared(); let index = shared_does_not_exists_index().await;
let index = server.unique_index();
let (response, code) = index.get().await; let (response, code) = index.get().await;
let expected_response = json!({ let expected_response = json!({
"message": format!("Index `{}` not found.", index.uid), "message": "Index `DOES_NOT_EXISTS` not found.",
"code": "index_not_found", "code": "index_not_found",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found" "link": "https://docs.meilisearch.com/errors#index_not_found"
@ -57,10 +56,10 @@ async fn list_multiple_indexes() {
let index1 = server.unique_index(); let index1 = server.unique_index();
let index2 = server.unique_index(); let index2 = server.unique_index();
let (task1, _) = index1.create(None).await; let (_task1, _) = index1.create(None).await;
let (_task2, _) = index2.create(Some("key")).await; let (task2, _) = index2.create(Some("key")).await;
index1.wait_task(task1.uid()).await.succeeded(); index1.wait_task(task2.uid()).await.succeeded();
let (response, code) = server.list_indexes(None, None).await; let (response, code) = server.list_indexes(None, None).await;
dbg!(response.clone()); dbg!(response.clone());