Skip to content

Commit 73b5002

Browse files
committed
Fixed health check tests
- Updated the health check test setup to use the provided configuration directly instead of cloning it. - Added a new test for health check success timing to validate the behavior with an increased timeout. - Enhanced logging setup for better visibility during test execution.
1 parent e9de20d commit 73b5002

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pdp-server/src/api/health/handlers.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ mod test {
384384

385385
let mut config = crate::config::PDPConfig::for_test_with_mocks(&horizon_mock, &opa_mock);
386386
config.healthcheck_timeout = 0.5;
387-
let fixture = TestFixture::with_config(config.clone(), opa_mock, horizon_mock).await;
387+
let fixture = TestFixture::with_config(config, opa_mock, horizon_mock).await;
388388

389389
let start_time = Instant::now();
390390
let response_with_cache = fixture.get("/health?check_cache=true").await;
@@ -428,9 +428,16 @@ mod test {
428428
"Concurrent check took too long: {:?}",
429429
duration_with_cache
430430
);
431+
}
431432

432-
config.healthcheck_timeout = 2.0;
433+
#[tokio::test]
434+
async fn test_health_check_success_timing() {
435+
TestFixture::setup_logger(LevelFilter::Info);
433436
let (horizon_mock_success, opa_mock_success) = setup_healthy_mocks().await;
437+
438+
let mut config =
439+
crate::config::PDPConfig::for_test_with_mocks(&horizon_mock_success, &opa_mock_success);
440+
config.healthcheck_timeout = 2.0;
434441
let fixture_success =
435442
TestFixture::with_config(config, opa_mock_success, horizon_mock_success).await;
436443

0 commit comments

Comments
 (0)