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)"
);
}