MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / test_reload_invalid_preserves_old

Function test_reload_invalid_preserves_old

crates/openshell-server/src/tls.rs:431–458  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

429
430 #[test]
431 fn test_reload_invalid_preserves_old() {
432 install_rustls_provider();
433 let dir = tempfile::tempdir().expect("failed to create tempdir");
434 generate_test_certs_with_ca(dir.path());
435
436 let acceptor = TlsAcceptor::from_files(
437 &dir.path().join("server-cert.pem"),
438 &dir.path().join("server-key.pem"),
439 Some(&dir.path().join("ca.pem")),
440 false,
441 )
442 .expect("failed to build acceptor");
443
444 // Snapshot the current config before corrupting files.
445 let acceptor_before = acceptor.acceptor();
446
447 std::fs::write(dir.path().join("server-cert.pem"), b"garbage")
448 .expect("failed to write garbage");
449
450 assert!(
451 acceptor.reload().is_err(),
452 "reload with garbage cert should fail"
453 );
454
455 // Old config must still be accessible after a failed reload.
456 drop(acceptor_before);
457 let _ = acceptor.acceptor(); // does not panic
458 }
459
460 #[tokio::test(flavor = "multi_thread")]
461 async fn test_concurrent_handshake_and_reload() {

Callers

nothing calls this directly

Calls 4

pathMethod · 0.80
acceptorMethod · 0.80
install_rustls_providerFunction · 0.70

Tested by

no test coverage detected