()
| 624 | |
| 625 | #[tokio::test] |
| 626 | async fn test_reload_worker_shutdown() { |
| 627 | install_rustls_provider(); |
| 628 | |
| 629 | let dir = tempfile::tempdir().expect("failed to create tempdir"); |
| 630 | generate_test_certs_with_ca(dir.path()); |
| 631 | let acceptor = TlsAcceptor::from_files( |
| 632 | &dir.path().join("server-cert.pem"), |
| 633 | &dir.path().join("server-key.pem"), |
| 634 | Some(&dir.path().join("ca.pem")), |
| 635 | false, |
| 636 | ) |
| 637 | .expect("failed to build acceptor"); |
| 638 | |
| 639 | let (shutdown_tx, shutdown_rx) = watch::channel(false); |
| 640 | let handle = acceptor.spawn_reload_worker(shutdown_rx); |
| 641 | |
| 642 | // Give the watcher time to start |
| 643 | tokio::time::sleep(Duration::from_millis(200)).await; |
| 644 | |
| 645 | // Send shutdown signal and verify the worker exits promptly. |
| 646 | // shutdown.changed() is checked in both the outer select (waiting |
| 647 | // for first event) and the inner debounce loop — no file change is |
| 648 | // needed to exercise the shutdown path. |
| 649 | let _ = shutdown_tx.send(true); |
| 650 | tokio::time::timeout(Duration::from_secs(2), handle) |
| 651 | .await |
| 652 | .expect("reload worker should exit after shutdown signal") |
| 653 | .expect("reload worker should not panic"); |
| 654 | } |
| 655 | |
| 656 | #[tokio::test] |
| 657 | async fn test_reload_worker_detects_file_change() { |
nothing calls this directly
no test coverage detected