File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1872,6 +1872,27 @@ pub(crate) fn clone_kind(kind: &ResumableKind) -> ResumableKind {
18721872mod tests {
18731873 use super :: * ;
18741874
1875+ #[ test]
1876+ fn google_store_new_builds_a_stream_client_with_the_ca ( ) {
1877+ // Issue #34: `GoogleDriveStore::new` derives its streaming client via
1878+ // `build_stream_client(ca)` (here `none`, offline). Covers the ctor +
1879+ // stream-client build path without a network/keychain dependency.
1880+ let tokens = crate :: google:: oauth:: Tokens {
1881+ access_token : String :: new ( ) ,
1882+ refresh_token : "rt" . to_string ( ) ,
1883+ expires_at : 0 ,
1884+ } ;
1885+ let http = build_meta_client ( & CustomCaConfig :: none ( ) ) . expect ( "meta client" ) ;
1886+ let source = RefreshingTokenSource :: new ( tokens, http, "cid" , "secret" ) ;
1887+ let store = GoogleDriveStore :: new (
1888+ build_meta_client ( & CustomCaConfig :: none ( ) ) . expect ( "meta client" ) ,
1889+ source,
1890+ & CustomCaConfig :: none ( ) ,
1891+ ) ;
1892+ // The streaming client is a distinct, usable handle (no panic on build).
1893+ let _ = store. http_stream ( ) ;
1894+ }
1895+
18751896 #[ test]
18761897 fn drive_clients_apply_custom_ca_fail_closed ( ) {
18771898 // Issue #34: the Drive metadata + stream clients add the custom CA
Original file line number Diff line number Diff line change @@ -592,6 +592,17 @@ mod tests {
592592 assert ! ( build_service_client( ServiceName :: Drive , & bad) . is_err( ) ) ;
593593 }
594594
595+ #[ tokio:: test]
596+ async fn drop_pool_rebuilds_the_service_client_with_the_stored_ca ( ) {
597+ // Issue #34: a pool teardown rebuilds the client re-applying the SAME CA
598+ // (here `none`, offline) - it must not panic or drop the client.
599+ let backend = ReqwestBackend :: new ( CustomCaConfig :: none ( ) ) . expect ( "construct backend" ) ;
600+ backend. drop_pool ( ServiceName :: Drive ) . await ;
601+ // Telemetry has no pooled client; drop is a no-op (early-return covered).
602+ backend. drop_pool ( ServiceName :: Telemetry ) . await ;
603+ assert ! ( backend. service_client( ServiceName :: Drive ) . is_some( ) ) ;
604+ }
605+
595606 // --- per-service client mapping covers exactly the probed services ---
596607
597608 #[ test]
You can’t perform that action at this time.
0 commit comments