MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestRunWatchSubcommandStopForeignPID

Function TestRunWatchSubcommandStopForeignPID

main_more_test.go:762–781  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

760}
761
762func TestRunWatchSubcommandStopForeignPID(t *testing.T) {
763 root := t.TempDir()
764
765 origRunning := watchIsRunning
766 origStop := stopWatchDaemon
767 defer func() {
768 watchIsRunning = origRunning
769 stopWatchDaemon = origStop
770 }()
771 watchIsRunning = func(string) bool { return true }
772 stopWatchDaemon = func(string) error { return watch.ErrForeignDaemonPID }
773
774 stdout, _ := captureMainStreams(t, func() { runWatchSubcommand("stop", root) })
775 if !strings.Contains(stdout, "cleared stale PID file") {
776 t.Fatalf("expected stale-PID message on foreign PID, got:\n%s", stdout)
777 }
778 if strings.Contains(stdout, "Watch daemon stopped") {
779 t.Fatalf("should not claim the daemon was stopped for a foreign PID:\n%s", stdout)
780 }
781}

Callers

nothing calls this directly

Calls 2

captureMainStreamsFunction · 0.85
runWatchSubcommandFunction · 0.85

Tested by

no test coverage detected