MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdDoBackgroundAlreadyRunning

Function TestCmdDoBackgroundAlreadyRunning

internal/app/background_test.go:172–192  ·  view source on GitHub ↗

TestCmdDoBackgroundAlreadyRunning: re-running while the session is alive in the registry must NOT spawn or resume — just report.

(t *testing.T)

Source from the content-addressed store, hash-verified

170// TestCmdDoBackgroundAlreadyRunning: re-running while the session is alive
171// in the registry must NOT spawn or resume — just report.
172func TestCmdDoBackgroundAlreadyRunning(t *testing.T) {
173 setupFlowRoot(t)
174 seedTask(t, "bgt")
175 stubBGMode(t)
176 stubITerm(t)
177 reg := bgAgentsJSON(bgFullSID)
178 c := stubBGCommand(t, &reg)
179
180 if rc := cmdDo([]string{"bgt"}); rc != 0 { // fresh spawn, binds bgFullSID
181 t.Fatalf("first cmdDo rc=%d", rc)
182 }
183 if rc := cmdDo([]string{"bgt"}); rc != 0 { // session still alive
184 t.Fatalf("second cmdDo rc=%d", rc)
185 }
186 if c.spawn != 1 {
187 t.Errorf("spawn calls = %d, want 1 (no re-spawn when already running)", c.spawn)
188 }
189 if c.resume != 0 {
190 t.Errorf("resume calls = %d, want 0 (already running, not gone)", c.resume)
191 }
192}
193
194// TestCmdDoBackgroundResumeWhenGone: a bound session ABSENT from the
195// registry is brought back via --bg --resume <oldid>, and because --bg

Callers

nothing calls this directly

Calls 7

setupFlowRootFunction · 0.85
seedTaskFunction · 0.85
stubBGModeFunction · 0.85
stubITermFunction · 0.85
bgAgentsJSONFunction · 0.85
stubBGCommandFunction · 0.85
cmdDoFunction · 0.85

Tested by

no test coverage detected