Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions crates/devstack/tests/daemon_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2418,15 +2418,19 @@ fn a_worktree_runs_as_a_lane() {
"the lanes' `tray` runs on\n{}",
s.diag()
);
let lane_pid = lane_info()["pid"].clone();
let lane_instance = lane_info()["instance"].clone();
s.cli(&["up"], None); // `broken` fails, the rest runs
assert!(
wait_for(|| s.api("/health").is_some(), Duration::from_secs(120)),
"the main tree runs again\n{}",
s.diag()
);
assert_eq!(s.daemon_pid(), daemon, "in the same daemon");
assert_eq!(lane_info()["pid"], lane_pid, "the lane ran on, untouched");
assert_eq!(
lane_info()["instance"],
lane_instance,
"the lane ran on, untouched"
);

// A restart of the stack carries the lane over (ADR-0052): the next
// daemon starts it again, from the artifact it ran, without `up` in its
Expand All @@ -2452,7 +2456,12 @@ fn a_worktree_runs_as_a_lane() {
s.diag()
);
assert_ne!(s.daemon_pid(), daemon, "a new daemon");
assert_ne!(lane_info()["pid"], lane_pid, "the lane started again");
// Its process, not its pid: Windows may give the new one the old pid.
assert_ne!(
lane_info()["instance"],
lane_instance,
"the lane started again"
);
// Logged once the lane's `up` is through, which waits for every service;
// its api answers before that.
assert!(
Expand Down
3 changes: 3 additions & 0 deletions examples/fixture-stack/src/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

var app = WebApplication.CreateBuilder(args).Build();
var workers = Environment.GetEnvironmentVariable("Jobs__Enabled") == "true";
// One per process: a pid can come again (Windows reuses them quickly).
var instance = Guid.NewGuid().ToString();

app.MapGet("/health", () => Results.Ok("ok"));
app.MapGet("/env/{name}", (string name) => Environment.GetEnvironmentVariable(name) ?? "");
Expand All @@ -13,6 +15,7 @@
slot = Environment.GetEnvironmentVariable("DEVSTACK_SLOT"),
workers,
pid = Environment.ProcessId,
instance,
});

// Long-lived connections, for the promotion comparison (ADR-0010): which
Expand Down
Loading