mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
use shared servers
This commit is contained in:
parent
84b4219a4f
commit
2654ce6e6c
@ -3,8 +3,8 @@ use crate::json;
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn create_and_delete_index() {
|
async fn create_and_delete_index() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = server.index("test");
|
let index = server.unique_index();
|
||||||
let (response, code) = index.create(None).await;
|
let (response, code) = index.create(None).await;
|
||||||
|
|
||||||
assert_eq!(code, 202);
|
assert_eq!(code, 202);
|
||||||
@ -24,14 +24,18 @@ async fn create_and_delete_index() {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn error_delete_unexisting_index() {
|
async fn error_delete_unexisting_index() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = server.index("test");
|
let index = server.unique_index();
|
||||||
let (task, code) = index.delete().await;
|
let (task, code) = index.delete().await;
|
||||||
|
|
||||||
assert_eq!(code, 202);
|
assert_eq!(code, 202);
|
||||||
|
|
||||||
|
let msg = format!(
|
||||||
|
"Index `{}` not found.",
|
||||||
|
task["indexUid"].as_str().expect("indexUid should exist").trim_matches('"')
|
||||||
|
);
|
||||||
let expected_response = json!({
|
let expected_response = json!({
|
||||||
"message": "Index `test` not found.",
|
"message": msg,
|
||||||
"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"
|
||||||
@ -44,8 +48,8 @@ async fn error_delete_unexisting_index() {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn loop_delete_add_documents() {
|
async fn loop_delete_add_documents() {
|
||||||
let server = Server::new().await;
|
let server = Server::new_shared();
|
||||||
let index = server.index("test");
|
let index = server.unique_index();
|
||||||
let documents = json!([{"id": 1, "field1": "hello"}]);
|
let documents = json!([{"id": 1, "field1": "hello"}]);
|
||||||
let mut tasks = Vec::new();
|
let mut tasks = Vec::new();
|
||||||
for _ in 0..50 {
|
for _ in 0..50 {
|
||||||
|
Loading…
Reference in New Issue
Block a user