use super::*;
use std::path::Path;
#[tokio::test]
async fn an_unrepresentable_wait_bound_is_an_input_error() {
let scratch = crate::test_os::tempdir();
let context = Context::new(scratch.path(), Some(scratch.path()), Path::new("")).unwrap();
let error = wait(
&context,
&"run-missing".parse().unwrap(),
Some(Duration::MAX),
CancellationToken::new(),
)
.await
.unwrap_err();
assert_eq!(error, "Run observation bound is too large.");
}
#[test]
fn core_durations_keep_the_existing_integer_second_wire_values() {
let observed = RunObservation {
run: "run-wire".parse().unwrap(),
state: State::Running,
counts: Counts::default(),
elapsed: Duration::from_millis(1250),
next_check: Duration::from_secs(30),
};
let wire = serde_json::to_value(observed).unwrap();
assert_eq!(wire["elapsed"], 1);
assert_eq!(wire["next_check"], 30);
}