MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_cert_store_builder

Function test_cert_store_builder

gateway/src/cert_store.rs:362–387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

360
361 #[test]
362 fn test_cert_store_builder() {
363 let data = make_test_cert_data();
364
365 // Use builder - domain is base domain (e.g., "example.com")
366 // All gateway certs are wildcard certs
367 let mut builder = CertStoreBuilder::new();
368 builder
369 .add_cert("example.com", &data)
370 .expect("failed to add cert");
371
372 let store = builder.build();
373
374 // Check it's loaded (stored by base domain)
375 assert!(store.has_cert("example.com"));
376 assert_eq!(store.list_domains().len(), 1);
377
378 // Should resolve any subdomain via wildcard matching
379 assert!(store.has_cert_for_sni("test.example.com"));
380 assert!(store.has_cert_for_sni("foo.example.com"));
381
382 // Should not resolve exact base domain (wildcard doesn't match base)
383 assert!(!store.has_cert_for_sni("example.com"));
384
385 // Should not resolve different domain
386 assert!(!store.has_cert_for_sni("example.org"));
387 }
388
389 #[test]
390 fn test_cert_store_wildcard() {

Callers

nothing calls this directly

Calls 3

make_test_cert_dataFunction · 0.85
add_certMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected