mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
39 lines
915 B
Rust
39 lines
915 B
Rust
use serde_json::json;
|
|
use std::convert::Into;
|
|
|
|
mod common;
|
|
|
|
#[test]
|
|
fn test_healthyness() {
|
|
let mut server = common::Server::with_uid("movies");
|
|
|
|
// Check that the server is healthy
|
|
|
|
let (_response, status_code) = server.get_health();
|
|
assert_eq!(status_code, 200);
|
|
|
|
// Set the serve Unhealthy
|
|
let body = json!({
|
|
"health": false,
|
|
});
|
|
let (_response, status_code) = server.update_health(body);
|
|
assert_eq!(status_code, 200);
|
|
|
|
// Check that the server is unhealthy
|
|
|
|
let (_response, status_code) = server.get_health();
|
|
assert_eq!(status_code, 503);
|
|
|
|
// Set the server healthy
|
|
let body = json!({
|
|
"health": true,
|
|
});
|
|
let (_response, status_code) = server.update_health(body);
|
|
assert_eq!(status_code, 200);
|
|
|
|
// Check if the server is healthy
|
|
|
|
let (_response, status_code) = server.get_health();
|
|
assert_eq!(status_code, 200);
|
|
}
|