package hostfloor import ( "reflect" "strings" "testing" ) func TestConsoleGuardDropInStartsServe(t *testing.T) { const path = "/opt/carlos/console/current/console" body := ConsoleGuardDropIn(path) prefix := "[Service]\nExecStart=\nExecStart=" if !strings.HasPrefix(body, prefix) { t.Fatalf("drop-in does not reset ExecStart: %q", body) } args := strings.Fields(strings.TrimPrefix(body, prefix)) want := []string{"/opt/carlos/system/guard/carlos", "system", "guard-exec", "console", path, "serve"} if !reflect.DeepEqual(args, want) { t.Fatalf("guarded console invocation = %q, want %q", args, want) } }