Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion internal/cli/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,19 @@ func runDoctor(cmd *cobra.Command) []docker.Check {
})
} else {
v, _ := db.SchemaVersion()
db.Close()
checks = append(checks, docker.Check{Name: "state ledger", Status: docker.StatusOK, Detail: fmt.Sprintf("schema v%d @ %s", v, ctxName)})
// Shared-service ledger summary (informational): instances + total refs.
shared, _ := db.ListSharedServices()
totalRefs := 0
for _, s := range shared {
n, _ := db.RefCount(s.Name)
totalRefs += n
}
db.Close()
checks = append(checks, docker.Check{
Name: "shared services", Status: docker.StatusOK,
Detail: fmt.Sprintf("%d instance(s), %d ref(s)", len(shared), totalRefs),
})
}

// DNS entries for *.localhost (spec 05) — best-effort, only when the current
Expand Down
12 changes: 12 additions & 0 deletions internal/cli/gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ func TestDoctorIncludesTrustProbe(t *testing.T) {
t.Errorf("doctor --json missing the trust probe:\n%s", out.String())
}
}

func TestDoctorIncludesSharedProbe(t *testing.T) {
var out strings.Builder
root := NewRootCmd(Options{})
root.SetArgs([]string{"doctor", "--json"})
root.SetOut(&out)
root.SetErr(&out)
_ = root.Execute()
if !strings.Contains(out.String(), `"shared services"`) {
t.Errorf("doctor --json missing the shared-services probe:\n%s", out.String())
}
}
Loading