MCPcopy Create free account
hub / github.com/compozy/agh / TestCLIAgentAuthoredContextIntegration

Function TestCLIAgentAuthoredContextIntegration

internal/cli/cli_integration_test.go:481–649  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

479}
480
481func TestCLIAgentAuthoredContextIntegration(t *testing.T) {
482 t.Parallel()
483
484 h := newIntegrationHarness(t)
485 mustExecuteRoot(t, h.deps, "daemon", "start", "--json")
486 defer func() {
487 stopStdout, stopStderr, stopErr := executeRootCommand(t, h.deps, "daemon", "stop", "--json")
488 if stopErr != nil {
489 t.Logf("daemon stop error = %v; stderr=%s; stdout=%s", stopErr, stopStderr, stopStdout)
490 if signalErr := h.runner.signalProcess(h.runner.pid, syscall.SIGTERM); signalErr != nil {
491 t.Logf("fallback daemon signal error = %v", signalErr)
492 }
493 }
494 done := make(chan error, 1)
495 go func() {
496 done <- h.runner.waitForExit()
497 }()
498 select {
499 case waitErr := <-done:
500 if waitErr != nil {
501 t.Logf("daemon wait error = %v", waitErr)
502 }
503 case <-time.After(5 * time.Second):
504 t.Log("daemon wait timed out during authored-context integration cleanup")
505 }
506 }()
507 writeWorkspaceAgentDef(t, h.workspace, "coder")
508 mustExecuteRoot(t, h.deps, "workspace", "add", h.workspace, "--name", "alpha", "--json")
509
510 soulBodyPath := filepath.Join(t.TempDir(), "SOUL.md")
511 soulBody := strings.Join([]string{
512 "---",
513 `version: "1"`,
514 "role: Reviewer",
515 "tone:",
516 " - concise",
517 "principles:",
518 " - Keep scope tight",
519 "---",
520 "Review implementation behavior.",
521 "",
522 }, "\n")
523 if err := os.WriteFile(soulBodyPath, []byte(soulBody), 0o600); err != nil {
524 t.Fatalf("os.WriteFile(SOUL.md) error = %v", err)
525 }
526
527 soulWriteOut, soulWriteStderr, soulWriteErr := executeRootCommand(
528 t,
529 h.deps,
530 "agent",
531 "soul",
532 "write",
533 "coder",
534 "--file",
535 soulBodyPath,
536 "--expected-digest",
537 "",
538 "--workspace",

Callers

nothing calls this directly

Calls 8

newIntegrationHarnessFunction · 0.85
mustExecuteRootFunction · 0.85
executeRootCommandFunction · 0.85
writeWorkspaceAgentDefFunction · 0.85
signalProcessMethod · 0.80
ContainsMethod · 0.80
WriteFileMethod · 0.65
waitForExitMethod · 0.45

Tested by

no test coverage detected