Add service status and usage dashboard, refresh externally published edits
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user