Add service status and usage dashboard, refresh externally published edits

This commit is contained in:
2026-10-09 20:20:44 +01:00
parent 67ac79765f
commit a50e8648f6
31 changed files with 1283 additions and 42 deletions
+33
View File
@@ -53,6 +53,39 @@ func TestCLIHelpDoesNotNeedServer(t *testing.T) {
}
}
func TestCLIStatusAndStatistics(t *testing.T) {
t.Setenv("PIPELINES_NTFY_URL", "")
run, _, _ := setup(t)
output, err := run("status")
if err != nil {
t.Fatal(err)
}
for _, text := range []string{"Pipelines server", "ntfy", "not configured", "Server computer IPs", "Port:"} {
if !strings.Contains(output, text) {
t.Fatal("missing CLI status", text, output)
}
}
output, err = run("status", "--json")
if err != nil {
t.Fatal(err)
}
var status protocol.SystemStatus
if err := json.Unmarshal([]byte(output), &status); err != nil || status.Server.Health != "healthy" || status.Server.Port == "" {
t.Fatal(output, err)
}
output, err = run("stats", "--json")
if err != nil {
t.Fatal(err)
}
var usage protocol.UsageStats
if err := json.Unmarshal([]byte(output), &usage); err != nil || usage.Total != 0 || len(usage.Days) != 14 {
t.Fatal(output, err)
}
if _, err := run("status", "extra"); err == nil {
t.Fatal("status accepted extra positional")
}
}
func TestCLIDraftValidateSubmitAndImmutableHistory(t *testing.T) {
run, store, _ := setup(t)
output, err := run("new", "example", "--template", "bug-fix", "--json")