2026-10-24 10:08:44 +02:00
|
|
|
package test
|
|
|
|
|
|
2026-10-24 11:15:35 +02:00
|
|
|
// Process-boundary tests for the diagnostic commands against a real daemon.
|
2026-10-24 10:08:44 +02:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
2026-10-24 11:15:35 +02:00
|
|
|
// TestDoctorWithDaemon: when the daemon runs it is ✔ with version and log
|
|
|
|
|
// path; voices and test work as processes.
|
|
|
|
|
func TestDoctorWithDaemon(t *testing.T) {
|
2026-10-24 10:08:44 +02:00
|
|
|
root := t.TempDir()
|
|
|
|
|
fake := newFakeProvider(t, 0)
|
|
|
|
|
d := startDaemon(t, root, fake.srv.URL, nil)
|
|
|
|
|
env := daemonEnv(root, d.port, fake.srv.URL, nil)
|
|
|
|
|
|
|
|
|
|
res := runTalk(t, env, "doctor")
|
|
|
|
|
if res.code != 0 {
|
2026-10-24 11:15:35 +02:00
|
|
|
t.Fatalf("talk doctor: exit %d\n%s\n%s", res.code, res.stdout, res.stderr)
|
2026-10-24 10:08:44 +02:00
|
|
|
}
|
2026-10-24 11:15:35 +02:00
|
|
|
for _, want := range []string{"✔ Daemon", "running at " + d.baseURL, "daemon.log", "✔ elevenlabs", "key set"} {
|
2026-10-24 10:08:44 +02:00
|
|
|
if !strings.Contains(res.stdout, want) {
|
2026-10-24 11:15:35 +02:00
|
|
|
t.Errorf("doctor without %q:\n%s", want, res.stdout)
|
2026-10-24 10:08:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res = runTalk(t, env, "doctor", "--probe")
|
2026-10-24 11:15:35 +02:00
|
|
|
if res.code != 0 || !strings.Contains(res.stdout, "probe ok") {
|
|
|
|
|
t.Errorf("doctor --probe: exit %d\n%s", res.code, res.stdout)
|
2026-10-24 10:08:44 +02:00
|
|
|
}
|
|
|
|
|
fake.waitArrived(t, 1)
|
|
|
|
|
|
|
|
|
|
if res := runTalk(t, env, "voices"); res.code != 0 || !strings.HasPrefix(res.stdout, "PROVIDER") {
|
2026-10-24 11:15:35 +02:00
|
|
|
t.Errorf("talk voices: exit %d, stdout %q", res.code, res.stdout)
|
2026-10-24 10:08:44 +02:00
|
|
|
}
|
2026-10-24 11:15:35 +02:00
|
|
|
if res := runTalk(t, env, "test"); res.code != 0 || !strings.Contains(res.stdout, "provider: elevenlabs") {
|
|
|
|
|
t.Errorf("talk test: exit %d, stdout %q, stderr %q", res.code, res.stdout, res.stderr)
|
2026-10-24 10:08:44 +02:00
|
|
|
}
|
|
|
|
|
}
|