Refresh unit requests and preserve shared compilation across runtime shutdown
This commit is contained in:
@@ -154,6 +154,49 @@ fn lines(path: &Path) -> Vec<String> {
|
||||
.map(str::to_owned)
|
||||
.collect()
|
||||
}
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn immediate_start_reads_new_and_edited_units() {
|
||||
let _serial = SERIAL.lock().await;
|
||||
let (temp, runtime, root) = world();
|
||||
let supervisor = supervise(runtime.clone());
|
||||
let path = temp.path().join("world");
|
||||
wait(|| path.join("var/log/journal").exists()).await;
|
||||
let unit = "/run/systemd/transient/immediate.service";
|
||||
write(
|
||||
&root,
|
||||
unit,
|
||||
b"[Service]\nType=oneshot\nExecStart=probe oneshot /old.log\n",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(
|
||||
run(&runtime, &["/bin/systemctl.wasm", "start", "immediate"])
|
||||
.await
|
||||
.0,
|
||||
0
|
||||
);
|
||||
wait(|| lines(&path.join("old.log")) == ["start"]).await;
|
||||
write(
|
||||
&root,
|
||||
unit,
|
||||
b"[Service]\nType=oneshot\nExecStart=probe oneshot /new.log\n",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(
|
||||
run(&runtime, &["/bin/systemctl.wasm", "start", "immediate"])
|
||||
.await
|
||||
.0,
|
||||
0
|
||||
);
|
||||
wait(|| lines(&path.join("new.log")) == ["start"]).await;
|
||||
assert_eq!(lines(&path.join("old.log")), ["start"]);
|
||||
assert_eq!(
|
||||
run(&runtime, &["/bin/systemctl.wasm", "start", "missing"])
|
||||
.await
|
||||
.0,
|
||||
5
|
||||
);
|
||||
supervisor.shutdown().await;
|
||||
}
|
||||
#[tokio::test]
|
||||
async fn unrelated_bursts_and_watched_overflow_only_reload_changed_units() {
|
||||
let _serial = SERIAL.lock().await;
|
||||
|
||||
Reference in New Issue
Block a user