-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
567 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
use actix_web::{get, HttpResponse, Responder}; | ||
|
||
#[utoipa::path( | ||
get, | ||
path = "/health", | ||
responses( | ||
(status = 200, description = "Ok", body = HealthCheckModel, content_type = "text/plain") | ||
), | ||
)] | ||
#[get("/health")] | ||
pub async fn handle() -> impl Responder { | ||
HttpResponse::Ok().body("Ok") | ||
HttpResponse::Ok().content_type("text/plain").body("Ok") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
use actix_web::{test, App}; | ||
use actix_web::{body::MessageBody, test, web, App}; | ||
|
||
#[actix_web::test] | ||
async fn test_healthcheck_endpoint() { | ||
let app = test::init_service(App::new().service(atlas_rs::services::healthcheck::handle)).await; | ||
let req = test::TestRequest::get().uri("/health").to_request(); | ||
let resp = test::call_service(&app, req).await; | ||
assert!(resp.status().is_success()); | ||
let body = resp.into_body().try_into_bytes().unwrap(); | ||
assert_eq!(body, web::Bytes::from_static(b"Ok")); | ||
} |