mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
refactor /health on meilisearch-http that complies:
1. NEEDS to ensure that service is completely up if it returns 204 2. DOES NOT block service process (write transaction) 3. NEEDS to use the less network bandwidth as possible when it's triggered 4. NEEDS to use the less service resources as possible when it's triggered 5. DOES NOT NEED any authentication 6. MAY be named /health
This commit is contained in:
@ -1,6 +1,3 @@
|
||||
use serde_json::json;
|
||||
use std::convert::Into;
|
||||
|
||||
mod common;
|
||||
|
||||
#[actix_rt::test]
|
||||
@ -10,29 +7,5 @@ async fn test_healthyness() {
|
||||
// Check that the server is healthy
|
||||
|
||||
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).await;
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
// Check that the server is unhealthy
|
||||
|
||||
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).await;
|
||||
assert_eq!(status_code, 200);
|
||||
|
||||
// Check if the server is healthy
|
||||
|
||||
let (_response, status_code) = server.get_health().await;
|
||||
assert_eq!(status_code, 200);
|
||||
assert_eq!(status_code, 204);
|
||||
}
|
||||
|
Reference in New Issue
Block a user