Something went wrong. Try again.
Run multiple services in one command. Brings startup dependency support and autoreload with change detection.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970package cli
import ( "bytes" "os" "path/filepath" "strings" "testing")
// testManifest writes one CLI fixture to an isolated temporary directory.func testManifest(t *testing.T, body string) string { t.Helper() path := filepath.Join(t.TempDir(), "case.yaml") if err := os.WriteFile(path, []byte(body), 0o600); err != nil { t.Fatal(err) } return path}
// TestValidateAndGraph exercises the two read-only project commands.func TestValidateAndGraph(t *testing.T) { path := testManifest(t, `version: 1project: demoservices: setup: type: task run: echo ready api: run: go run . depends_on: setup: completed`) var stdout, stderr bytes.Buffer if err := Run([]string{"validate", "-f", path}, &stdout, &stderr); err != nil { t.Fatal(err) } if !strings.Contains(stdout.String(), "startup order: setup, api") { t.Fatalf("output = %q", stdout.String()) } stdout.Reset() if err := Run([]string{"graph", "-f", path}, &stdout, &stderr); err != nil { t.Fatal(err) } if !strings.Contains(stdout.String(), "api <- setup:completed") { t.Fatalf("output = %q", stdout.String()) }}
// TestGraphRejectsCycle verifies graph errors propagate through the CLI.func TestGraphRejectsCycle(t *testing.T) { path := testManifest(t, `version: 1services: a: run: a depends_on: b: started b: run: b depends_on: a: started`) err := Run([]string{"graph", "-f", path}, &bytes.Buffer{}, &bytes.Buffer{}) if err == nil || !strings.Contains(err.Error(), "dependency cycle") { t.Fatalf("error = %v", err) }}