//! COV-12/FWD-12: `SharedHttpClient::config()` reflects the config the //! running clients were built from, and a `reload` swaps the config //! together with both clients in one atomic store — after a reload, //! `config()` shows the new generation and the old one is unreachable //! for every late reader (FWD-12's atomicity assertion). use std::time::Duration; use alkhttp::client::{HttpClientConfig, SharedHttpClient}; #[test] fn config_accessor_tracks_a_reloaded_config() { let initial = HttpClientConfig { retry_after_ceiling: Duration::from_secs(11), ..HttpClientConfig::default() }; let http = SharedHttpClient::new(initial).expect("initial client builds"); assert_eq!( http.config().retry_after_ceiling, Duration::from_secs(11), "config() starts as the config the client was built from" ); let reloaded = HttpClientConfig { retry_after_ceiling: Duration::from_secs(22), ..HttpClientConfig::default() }; futures::executor::block_on(http.reload(reloaded)).expect("reload succeeds"); assert_eq!( http.config().retry_after_ceiling, Duration::from_secs(22), "config() reflects the reloaded generation, not the initial one (FWD-12)" ); }