mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-11 14:04:31 +01:00
Merge #99
99: return a 200 on health check r=MarinPostma a=irevoire closes #92 Co-authored-by: tamo <tamo@meilisearch.com>
This commit is contained in:
commit
588bc8f9ef
@ -9,5 +9,5 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||||||
|
|
||||||
#[get("/health")]
|
#[get("/health")]
|
||||||
async fn get_health() -> Result<HttpResponse, ResponseError> {
|
async fn get_health() -> Result<HttpResponse, ResponseError> {
|
||||||
Ok(HttpResponse::NoContent().finish())
|
Ok(HttpResponse::Ok().json(serde_json::json!({ "status": "available" })))
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,12 @@ async fn get_settings_unexisting_index() {
|
|||||||
assert!(version.get("buildDate").is_some());
|
assert!(version.get("buildDate").is_some());
|
||||||
assert!(version.get("pkgVersion").is_some());
|
assert!(version.get("pkgVersion").is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn test_healthyness() {
|
||||||
|
let server = Server::new().await;
|
||||||
|
|
||||||
|
let (response, status_code) = server.service.get("/health").await;
|
||||||
|
assert_eq!(status_code, 200);
|
||||||
|
assert_eq!(response["status"], "available");
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user