Skip to content

Commit a49dfa1

Browse files
pmaxhoganclaude
andcommitted
test(net,drive): cover drop_pool rebuild + GoogleDriveStore::new CA path
Bring the regression-vs-main coverage delta to ~neutral. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QZQVP2tUuTLh8oL31D8heC
1 parent 38c02d5 commit a49dfa1

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

crates/driven-drive/src/google/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,27 @@ pub(crate) fn clone_kind(kind: &ResumableKind) -> ResumableKind {
18721872
mod 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

crates/driven-net/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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]

0 commit comments

Comments
 (0)