mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
update tests & fix the broken code
This commit is contained in:
committed by
qdequele
parent
5e2861ff55
commit
27b3b53bc5
@ -3,36 +3,36 @@ use std::convert::Into;
|
||||
|
||||
mod common;
|
||||
|
||||
#[test]
|
||||
fn test_healthyness() {
|
||||
#[actix_rt::test]
|
||||
async fn test_healthyness() {
|
||||
let mut server = common::Server::with_uid("movies");
|
||||
|
||||
// Check that the server is healthy
|
||||
|
||||
let (_response, status_code) = server.get_health();
|
||||
let (_response, status_code) = server.get_health().await;
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
// Set the serve Unhealthy
|
||||
let body = json!({
|
||||
"health": false,
|
||||
});
|
||||
let (_response, status_code) = server.update_health(body);
|
||||
let (_response, status_code) = server.update_health(body).await;
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
// Check that the server is unhealthy
|
||||
|
||||
let (_response, status_code) = server.get_health();
|
||||
let (_response, status_code) = server.get_health().await;
|
||||
assert_eq!(status_code, 503);
|
||||
|
||||
// Set the server healthy
|
||||
let body = json!({
|
||||
"health": true,
|
||||
});
|
||||
let (_response, status_code) = server.update_health(body);
|
||||
let (_response, status_code) = server.update_health(body).await;
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
// Check if the server is healthy
|
||||
|
||||
let (_response, status_code) = server.get_health();
|
||||
let (_response, status_code) = server.get_health().await;
|
||||
assert_eq!(status_code, 200);
|
||||
}
|
||||
|
Reference in New Issue
Block a user