forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontract.rs
More file actions
22 lines (15 loc) · 802 Bytes
/
contract.rs
File metadata and controls
22 lines (15 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use torrust_tracker::servers::health_check_api::resources::Report;
use torrust_tracker_test_helpers::configuration;
use crate::servers::health_check_api::client::get;
use crate::servers::health_check_api::test_environment;
#[tokio::test]
async fn health_check_endpoint_should_return_status_ok_when_no_service_is_running() {
let configuration = configuration::ephemeral_with_no_services();
let (bound_addr, test_env) = test_environment::start(configuration.into()).await;
let url = format!("http://{bound_addr}/health_check");
let response = get(&url).await;
assert_eq!(response.status(), 200);
assert_eq!(response.headers().get("content-type").unwrap(), "application/json");
assert_eq!(response.json::<Report>().await.unwrap(), Report::ok());
test_env.abort();
}