| 1 | package console |
| 2 | |
| 3 | // The Overview dashboard's numbers and the Instances tab's one table |
| 4 | // (overview.go). Both assemblers are pure joins over what the app pages |
| 5 | // already read, so they are exercised directly here — the page tests below |
| 6 | // then prove the numbers actually reach a rendered page. |
| 7 | // |
| 8 | // The properties worth pinning are the ones where a plausible-looking number |
| 9 | // would be a lie: an unreadable stable pointer is UNKNOWN and not "not live", |
| 10 | // a sum over instances that reported nothing is nil and not zero, a domain |
| 11 | // mid-issuance needs patience and not attention, and a capped release list |
| 12 | // says so. |
| 13 | |
| 14 | import ( |
| 15 | "context" |
| 16 | "net/http" |
| 17 | "strings" |
| 18 | "testing" |
| 19 | "time" |
| 20 | |
| 21 | "github.com/carlosframework/platform/internal/registry" |
| 22 | "github.com/carlosframework/platform/internal/status" |
| 23 | ) |
| 24 | |
| 25 | // f64 and i64 are the pointer literals InstanceMetrics carries — nil is a |
| 26 | // meaningful value there (unreadable), so the tests need both. |
| 27 | func f64(v float64) *float64 { return &v } |
| 28 | func i64(v int64) *int64 { return &v } |
| 29 | |
| 30 | func TestOverviewLiveVersionFromOwnedRoutes(t *testing.T) { |
| 31 | view := &AppView{App: "kass", Channels: []ChannelView{ |
| 32 | {Name: "beta", Version: "v9"}, |
| 33 | {Name: "stable", Version: "v7", Err: "obsolete unreadable pointer"}, |
| 34 | }, Routes: []RouteView{{Host: "kass.example", Account: "bab", Channel: "edge", Version: "v9"}}} |
| 35 | st := assembleOverview(view, "bab", nil, nil, boxJoin{}) |
| 36 | if !st.Deployment.HasReportedVersion() { |
| 37 | t.Fatal("an app with a reported route version is not reported deployed") |
| 38 | } |
| 39 | if st.Deployment.UniformVersion() != "v9" { |
| 40 | t.Fatalf("observed version = %q, want v9", st.Deployment.UniformVersion()) |
| 41 | } |
| 42 | |
| 43 | // A pointer with no owned route is a target, not a deployment. |
| 44 | st = assembleOverview(&AppView{App: "kass", Channels: []ChannelView{{Name: "stable", Version: "v9"}}}, "bab", nil, nil, boxJoin{}) |
| 45 | if st.Deployment.HasReportedVersion() || st.Deployment.UniformVersion() != "" { |
| 46 | t.Fatalf("a never-promoted app reads as live: %+v", st) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Unknown is not the same as not live. A stable pointer that will not verify |
| 51 | // says so — claiming "not live" would tell an owner their app is down when the |
| 52 | // only thing broken is this console's read of it. |
| 53 | func TestOverviewUnknownRouteVersionIsUnknownNotOffline(t *testing.T) { |
| 54 | view := &AppView{App: "kass", Channels: []ChannelView{ |
| 55 | {Name: "stable", Err: "signature does not verify"}, |
| 56 | }, Routes: []RouteView{{Host: "kass.example", Account: "bab", Channel: "stable"}}} |
| 57 | st := assembleOverview(view, "bab", nil, nil, boxJoin{}) |
| 58 | if st.Deployment.HasReportedVersion() { |
| 59 | t.Fatal("an unreadable pointer was reported as a known live version") |
| 60 | } |
| 61 | if st.Deployment.UniformVersion() != "" { |
| 62 | t.Fatalf("observed version = %q, want nothing claimed from an unreadable pointer", st.Deployment.UniformVersion()) |
| 63 | } |
| 64 | if st.Verdict != "unknown" { |
| 65 | t.Fatalf("Verdict = %q, want unknown for an address with no version report", st.Verdict) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // The tiles render an em-dash for "no readings", never zeros — so the sums |
| 70 | // have to stay nil when nothing reported, and must cover only the instances |
| 71 | // that actually did. The instance COUNT comes from the routes, so a failed |
| 72 | // sweep (nil metrics) reads as readings-unavailable, never as a hostless app, |
| 73 | // and another account's same-named routes count for nothing at all. |
| 74 | func TestOverviewSumsOnlyReportingInstances(t *testing.T) { |
| 75 | view := &AppView{App: "kass", Routes: []RouteView{ |
| 76 | {Host: "a", Account: "bab", Kind: "instance"}, |
| 77 | {Host: "b", Account: "bab", Kind: "instance"}, |
| 78 | {Host: "c", Account: "bab", Kind: "instance"}, |
| 79 | {Host: "d", Account: "bab", Kind: "instance", Hibernate: true}, |
| 80 | {Host: "e", Account: "bab", Kind: "instance"}, |
| 81 | // Another account's same-named app: not this dashboard's instance. |
| 82 | {Host: "theirs", Account: "cdef", Kind: "instance"}, |
| 83 | }} |
| 84 | metrics := []InstanceMetrics{ |
| 85 | {Host: "a", Box: "box-1", CPUFrac: f64(0.25), MemBytes: i64(100)}, |
| 86 | {Host: "b", Box: "box-1", CPUFrac: f64(0.5), MemBytes: i64(200)}, |
| 87 | // Reporting, but this metric was unreadable: contributes nothing. |
| 88 | {Host: "c", Box: "box-2"}, |
| 89 | // Not reporting at all, with numbers that must NOT be counted. |
| 90 | {Host: "d", CPUFrac: f64(99), MemBytes: i64(99), Hibernate: true}, |
| 91 | {Host: "e"}, |
| 92 | } |
| 93 | st := assembleOverview(view, "bab", metrics, nil, boxJoin{}) |
| 94 | if st.InstanceTotal != 5 { |
| 95 | t.Fatalf("InstanceTotal = %d, want 5 (the routes, not the sweep, and never another account's)", st.InstanceTotal) |
| 96 | } |
| 97 | if st.InstanceReporting != 3 { |
| 98 | t.Fatalf("InstanceReporting = %d, want 3", st.InstanceReporting) |
| 99 | } |
| 100 | if st.InstanceAsleep != 1 { |
| 101 | t.Fatalf("InstanceAsleep = %d, want only the hibernating non-reporter", st.InstanceAsleep) |
| 102 | } |
| 103 | if st.CPUSum == nil || *st.CPUSum != 0.75 { |
| 104 | t.Fatalf("CPUSum = %v, want 0.75 — the non-reporters must not be summed", st.CPUSum) |
| 105 | } |
| 106 | if st.MemSum == nil || *st.MemSum != 300 { |
| 107 | t.Fatalf("MemSum = %v, want 300", st.MemSum) |
| 108 | } |
| 109 | if st.MetricsUnavailable { |
| 110 | t.Fatal("a sweep that ran reads as unavailable") |
| 111 | } |
| 112 | |
| 113 | // Nobody reported: nil, not zero. A zero here would render as "0%" and |
| 114 | // claim an idle app where there is simply no reading. |
| 115 | quietView := &AppView{App: "kass", Routes: []RouteView{{Host: "a", Account: "bab", Kind: "instance"}, {Host: "b", Account: "bab", Kind: "instance"}}} |
| 116 | quiet := assembleOverview(quietView, "bab", []InstanceMetrics{{Host: "a"}, {Host: "b"}}, nil, boxJoin{}) |
| 117 | if quiet.CPUSum != nil || quiet.MemSum != nil { |
| 118 | t.Fatalf("sums = %v %v with nothing reporting, want nil so the tiles show the em-dash", |
| 119 | quiet.CPUSum, quiet.MemSum) |
| 120 | } |
| 121 | if quiet.InstanceReporting != 0 || quiet.InstanceTotal != 2 { |
| 122 | t.Fatalf("quiet counts = %d/%d, want 0/2", quiet.InstanceReporting, quiet.InstanceTotal) |
| 123 | } |
| 124 | |
| 125 | // The sweep FAILED (nil metrics): the count must survive — "readings |
| 126 | // unavailable" is not "no hosts yet". |
| 127 | failed := assembleOverview(quietView, "bab", nil, nil, boxJoin{}) |
| 128 | if failed.InstanceTotal != 2 { |
| 129 | t.Fatalf("InstanceTotal = %d after a failed sweep, want the routes' 2", failed.InstanceTotal) |
| 130 | } |
| 131 | if !failed.MetricsUnavailable { |
| 132 | t.Fatal("a failed sweep does not read as unavailable") |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // TestOverviewSeparatesNoReadings pins InstanceNoReadings/InstanceCounted: |
| 137 | // a silent instance route the sweep was never told how to sample (no |
| 138 | // Provisioned, Unit or Backing) is honest ignorance, not an outage, and |
| 139 | // must not count against the Running tile's denominator. |
| 140 | func TestOverviewSeparatesNoReadings(t *testing.T) { |
| 141 | view := &AppView{Routes: []RouteView{ |
| 142 | {Host: "a.x", Kind: "instance", Account: "acct1", Provisioned: true}, // reporting |
| 143 | {Host: "b.x", Kind: "instance", Account: "acct1", Provisioned: true}, // silent, expected |
| 144 | {Host: "c.x", Kind: "instance", Account: "acct1"}, // silent, bespoke-unstamped |
| 145 | {Host: "d.x", Kind: "instance", Account: "acct1", Hibernate: true}, // asleep |
| 146 | }, Domains: []DomainView{{}, {}, {}, {}}} |
| 147 | metrics := []InstanceMetrics{{Host: "a.x", Box: "box1"}} |
| 148 | st := assembleOverview(view, "acct1", metrics, nil, boxJoin{}) |
| 149 | if st.InstanceExpected != 4 || st.InstanceReporting != 1 || st.InstanceAsleep != 1 || |
| 150 | st.InstanceNoReadings != 1 || st.InstanceCounted != 3 { |
| 151 | t.Fatalf("counts: %+v", st) |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | // TestVerdictIgnoresNoReadings pins that healthVerdict's shortfall case |
| 156 | // compares against InstanceCounted, not InstanceExpected — a no-readings |
| 157 | // row must not trip "attention" (the 2026-08-10 tito false alarm). |
| 158 | func TestVerdictIgnoresNoReadings(t *testing.T) { |
| 159 | // 1 reporting + 1 asleep + 1 no-readings out of 3 counted... construct an |
| 160 | // OverviewStats where Reporting+Asleep == InstanceCounted and assert the |
| 161 | // verdict is NOT "attention" on account of the no-readings row. |
| 162 | st := OverviewStats{Deployment: DeploymentStatus{RouteCount: 3, ReportableCount: 3, ReportedCount: 3}, InstanceExpected: 3, InstanceCounted: 2, |
| 163 | InstanceReporting: 1, InstanceAsleep: 1, InstanceNoReadings: 1} |
| 164 | if v, _ := healthVerdict(st); v != "ok" { |
| 165 | t.Fatalf("no-readings rows must not trip the verdict: %s", v) |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | // Attention means someone has to do something: DNS that is not pointing here, |
| 170 | // or issuance that failed. A cert mid-issuance is patience, not attention — |
| 171 | // badging it would make every new domain look broken for its first minute. |
| 172 | func TestOverviewDomainAttentionCountsGuidanceAndFailedTLS(t *testing.T) { |
| 173 | // Domains are counted through their PARALLEL routes (that is where the |
| 174 | // account lives), so the view carries both — including another tenant's |
| 175 | // same-named row, whose failed cert must not wave on this dashboard. |
| 176 | view := &AppView{App: "kass", |
| 177 | Routes: []RouteView{ |
| 178 | {Host: "a.example.com", Account: "bab"}, |
| 179 | {Host: "b.example.com", Account: "bab"}, |
| 180 | {Host: "c.example.com", Account: "bab"}, |
| 181 | {Host: "d.example.com", Account: "bab"}, |
| 182 | {Host: "e.example.com", Account: "bab"}, |
| 183 | {Host: "f.example.com", Account: "cdef"}, |
| 184 | }, |
| 185 | Domains: []DomainView{ |
| 186 | {Domain: "a.example.com", TLS: "ready · renews 2027-01-01"}, |
| 187 | {Domain: "b.example.com", TLS: "issuing"}, |
| 188 | {Domain: "c.example.com", TLS: ""}, |
| 189 | {Domain: "d.example.com", TLS: "failed: dns-01 timeout"}, |
| 190 | {Domain: "e.example.com", TLS: "ready", Guidance: "Point an A record for e.example.com at ..."}, |
| 191 | {Domain: "f.example.com", TLS: "failed: dns-01 timeout"}, |
| 192 | }} |
| 193 | st := assembleOverview(view, "bab", nil, nil, boxJoin{}) |
| 194 | if st.DomainTotal != 5 { |
| 195 | t.Fatalf("DomainTotal = %d, want 5 — the other account's domain is not this tenant's", st.DomainTotal) |
| 196 | } |
| 197 | if st.DomainAttention != 2 { |
| 198 | t.Fatalf("DomainAttention = %d, want 2 (the failed cert and the unpointed domain, never the other tenant's)", st.DomainAttention) |
| 199 | } |
| 200 | // The one-bit read on its own, so a miscount above is attributable. |
| 201 | for _, tc := range []struct { |
| 202 | name string |
| 203 | d DomainView |
| 204 | want bool |
| 205 | }{ |
| 206 | {"ready", DomainView{TLS: "ready · renews 2027-01-01"}, false}, |
| 207 | {"issuing", DomainView{TLS: "issuing"}, false}, |
| 208 | {"unknown", DomainView{TLS: ""}, false}, |
| 209 | {"failed", DomainView{TLS: "failed: dns-01 timeout"}, true}, |
| 210 | {"guidance", DomainView{TLS: "ready", Guidance: "point an A record"}, true}, |
| 211 | } { |
| 212 | if got := domainNeedsAttention(tc.d); got != tc.want { |
| 213 | t.Errorf("domainNeedsAttention(%s) = %v, want %v", tc.name, got, tc.want) |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // The versions list is capped, so the tile says "20+" rather than lying with |
| 219 | // a flat 20 — and the latest version is the newest, which is the list's head. |
| 220 | func TestOverviewReleasesCapped(t *testing.T) { |
| 221 | full := make([]VersionView, versionsCap) |
| 222 | for i := range full { |
| 223 | full[i] = VersionView{Version: "v" + string(rune('a'+i))} |
| 224 | } |
| 225 | st := assembleOverview(&AppView{App: "kass"}, "bab", nil, full, boxJoin{}) |
| 226 | if st.ReleaseCount != versionsCap || !st.ReleasesCapped { |
| 227 | t.Fatalf("count/capped = %d/%v, want %d/true", st.ReleaseCount, st.ReleasesCapped, versionsCap) |
| 228 | } |
| 229 | if st.LatestVersion != full[0].Version { |
| 230 | t.Fatalf("LatestVersion = %q, want the head of the newest-first list (%q)", st.LatestVersion, full[0].Version) |
| 231 | } |
| 232 | |
| 233 | short := assembleOverview(&AppView{App: "kass"}, "bab", nil, full[:versionsCap-1], boxJoin{}) |
| 234 | if short.ReleasesCapped { |
| 235 | t.Fatalf("a list one short of the cap was reported capped (%d)", short.ReleaseCount) |
| 236 | } |
| 237 | none := assembleOverview(&AppView{App: "kass"}, "bab", nil, nil, boxJoin{}) |
| 238 | if none.ReleaseCount != 0 || none.ReleasesCapped || none.LatestVersion != "" { |
| 239 | t.Fatalf("empty release list = %+v, want zeros and no version", none) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | // The join key is the host — the one name owners have for an instance — and |
| 244 | // an unswept route still gets its row, with Reporting false rather than zeros. |
| 245 | func TestInstanceRowsJoinMetricsByHost(t *testing.T) { |
| 246 | acct := &Account{ID: 1, Sqid: "bab"} |
| 247 | view := &AppView{App: "kass", Routes: []RouteView{ |
| 248 | {Host: "a.example.com", Account: "bab", Channel: "stable", Version: "v1", Kind: "instance", Status: "ready"}, |
| 249 | {Host: "b.example.com", Account: "bab", Channel: "canary/x", Kind: "instance", Status: "", Hibernate: true}, |
| 250 | }} |
| 251 | metrics := []InstanceMetrics{ |
| 252 | {Host: "b.example.com", Box: "box-1", CPUFrac: f64(0.1)}, |
| 253 | {Host: "ghost.example.com", Box: "box-1", CPUFrac: f64(9)}, |
| 254 | } |
| 255 | rows := assembleInstanceRows(view, acct, metrics) |
| 256 | if len(rows) != 2 { |
| 257 | t.Fatalf("rows = %+v, want one per route (a metrics row for an unrouted host adds nothing)", rows) |
| 258 | } |
| 259 | if rows[0].Host != "a.example.com" || rows[0].Metrics.Reporting() { |
| 260 | t.Fatalf("row[0] = %+v, want the unswept route present and not reporting", rows[0]) |
| 261 | } |
| 262 | // The registry contract: an empty status means ready, and the table must |
| 263 | // not print a blank cell for the commonest state there is. |
| 264 | if rows[1].Status != "ready" { |
| 265 | t.Fatalf("row[1].Status = %q, want the empty registry status rendered as \"ready\"", rows[1].Status) |
| 266 | } |
| 267 | if rows[0].Status != "ready" { |
| 268 | t.Fatalf("row[0].Status = %q, want its own explicit status kept", rows[0].Status) |
| 269 | } |
| 270 | if !rows[1].Hibernate { |
| 271 | t.Fatal("the route's hibernation setting did not reach its row") |
| 272 | } |
| 273 | if !rows[1].Metrics.Reporting() || rows[1].Metrics.CPUFrac == nil || *rows[1].Metrics.CPUFrac != 0.1 { |
| 274 | t.Fatalf("row[1].Metrics = %+v, want the sweep's reading joined by host", rows[1].Metrics) |
| 275 | } |
| 276 | if rows[0].Channel != "stable" || rows[1].Channel != "canary/x" || rows[0].Version != "v1" { |
| 277 | t.Fatalf("rows lost their route facts: %+v", rows) |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | // The tenant boundary, kept byte-for-byte with appResourceMetrics': routes are |
| 282 | // grouped by app NAME and app names are unique per ACCOUNT, so another |
| 283 | // account's route can legitimately arrive in this view — and must not become a |
| 284 | // row on this page. |
| 285 | func TestInstanceRowsSkipOtherAccountsRoutes(t *testing.T) { |
| 286 | acct := &Account{ID: 1, Sqid: "bab"} |
| 287 | view := &AppView{App: "kass", Routes: []RouteView{ |
| 288 | {Host: "mine.example.com", Account: "bab", Channel: "stable"}, |
| 289 | {Host: "theirs.example.com", Account: "cdef", Channel: "stable"}, |
| 290 | }} |
| 291 | metrics := []InstanceMetrics{{Host: "theirs.example.com", Box: "box-9", CPUFrac: f64(0.9)}} |
| 292 | rows := assembleInstanceRows(view, acct, metrics) |
| 293 | if len(rows) != 1 || rows[0].Host != "mine.example.com" { |
| 294 | t.Fatalf("rows = %+v, want only the viewing account's own route", rows) |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | // healthWord is the Instances table's whole Health column: provisioning |
| 299 | // state and hibernation and liveness folded into the one word an owner |
| 300 | // reads across the table. |
| 301 | func TestInstanceRowHealthWord(t *testing.T) { |
| 302 | cases := []struct { |
| 303 | kind, status string |
| 304 | hibernate bool |
| 305 | reporting bool |
| 306 | expect bool |
| 307 | want string |
| 308 | }{ |
| 309 | {"instance", "ready", false, true, true, "Running"}, |
| 310 | {"instance", "ready", true, false, true, "Asleep"}, |
| 311 | {"instance", "ready", false, false, true, "Not responding"}, |
| 312 | {"instance", "starting", false, false, true, "Setting up"}, |
| 313 | {"instance", "pending", false, false, true, "Setting up"}, |
| 314 | {"instance", "creating", false, false, true, "Setting up"}, |
| 315 | {"instance", "issuing", false, false, true, "Setting up"}, |
| 316 | {"instance", "failed", false, false, true, "Failed"}, |
| 317 | {"static", "ready", false, false, true, "Serving"}, |
| 318 | {"service", "ready", false, false, true, "Serving"}, |
| 319 | // silent + expected to report stays the red word |
| 320 | {kind: "instance", status: "ready", hibernate: false, reporting: false, expect: true, want: "Not responding"}, |
| 321 | // silent + nobody could sample it = honest ignorance, not an outage |
| 322 | {kind: "instance", status: "ready", hibernate: false, reporting: false, expect: false, want: "No readings"}, |
| 323 | // hibernation still wins over both |
| 324 | {kind: "instance", status: "ready", hibernate: true, reporting: false, expect: false, want: "Asleep"}, |
| 325 | } |
| 326 | for _, c := range cases { |
| 327 | got := healthWord(c.kind, c.status, c.hibernate, c.reporting, c.expect) |
| 328 | if got != c.want { |
| 329 | t.Errorf("healthWord(%q,%q,hib=%v,rep=%v,expect=%v) = %q, want %q", c.kind, c.status, c.hibernate, c.reporting, c.expect, got, c.want) |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | // TestSidecarHealthWordVocabulary: a sidecar never serves a request, so |
| 335 | // "Serving" — the catch-all for every non-instance kind — is simply false |
| 336 | // for it (the bug this pins). Sidecars get their own five words instead: |
| 337 | // Running, Asleep, Waking, Crashed, Never started. |
| 338 | func TestSidecarHealthWordVocabulary(t *testing.T) { |
| 339 | cases := []struct { |
| 340 | status string |
| 341 | hibernate bool |
| 342 | reporting bool |
| 343 | expect bool |
| 344 | want string |
| 345 | }{ |
| 346 | {"ready", false, true, true, "Running"}, // reporting a version over the socket |
| 347 | {"ready", true, false, true, "Asleep"}, // hibernating, not reporting |
| 348 | {"ready", false, false, true, "Crashed"}, // platform runs it, silent — presumed crashed |
| 349 | {"ready", false, false, false, "Never started"}, // never provisioned to run yet |
| 350 | {"starting", false, false, false, "Waking"}, |
| 351 | {"pending", false, false, false, "Waking"}, |
| 352 | {"creating", false, false, false, "Waking"}, |
| 353 | {"issuing", false, false, false, "Waking"}, |
| 354 | {"failed", false, false, false, "Crashed"}, |
| 355 | } |
| 356 | for _, c := range cases { |
| 357 | got := healthWord("sidecar", c.status, c.hibernate, c.reporting, c.expect) |
| 358 | if got != c.want { |
| 359 | t.Errorf("healthWord(sidecar,%q,hib=%v,rep=%v,expect=%v) = %q, want %q", |
| 360 | c.status, c.hibernate, c.reporting, c.expect, got, c.want) |
| 361 | } |
| 362 | if got == "Serving" { |
| 363 | t.Errorf("healthWord(sidecar,...) = Serving — a sidecar never serves a request") |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | // TestSidecarHealthWordsAreFilterable pins listquery.go's contract that |
| 369 | // "a new word joins healthWord, this list, and nothing else" — a sidecar |
| 370 | // word missing from healthWords would silently break the Running tab's |
| 371 | // health filter and its URL slug for that word. |
| 372 | func TestSidecarHealthWordsAreFilterable(t *testing.T) { |
| 373 | for _, w := range []string{"Waking", "Crashed", "Never started"} { |
| 374 | if healthFromSlug(healthSlug(w)) != w { |
| 375 | t.Errorf("healthWords is missing %q — its filter/slug round trip is broken", w) |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | // expectsReadings is the one rule for whether silence from a route's process |
| 381 | // means something: the platform runs the process (provisioned, or a |
| 382 | // carlos-app@ tenant) or a stamped unit tells the sweep where to look. |
| 383 | // Anything else — a manually-added route whose process some bespoke, |
| 384 | // unstamped unit owns — is honest ignorance, not an outage. |
| 385 | func TestExpectsReadings(t *testing.T) { |
| 386 | cases := []struct { |
| 387 | provisioned bool |
| 388 | unit, backing string |
| 389 | want bool |
| 390 | }{ |
| 391 | {true, "", "", true}, // instances-API-minted: activator-run |
| 392 | {false, "titogo@x.service", "", true}, // stamped: the sweep samples it |
| 393 | {false, "", registry.BackingUnit, true}, // carlos-app@ tenant |
| 394 | {false, "", "", false}, // manual exec-shaped row: can't tell |
| 395 | } |
| 396 | for _, c := range cases { |
| 397 | if got := expectsReadings(c.provisioned, c.unit, c.backing); got != c.want { |
| 398 | t.Fatalf("expectsReadings(%v,%q,%q) = %v", c.provisioned, c.unit, c.backing, got) |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | // The Overview page is the tiles, and only the tiles: the ladder moved to the |
| 404 | // Releases tab, and a copy left behind here would be two places to read the |
| 405 | // same state from. |
| 406 | func TestOverviewPageRendersTiles(t *testing.T) { |
| 407 | fx := newConsoleFixture(t) |
| 408 | c := signInPaul(t, fx) |
| 409 | |
| 410 | status, _, body := get(t, c, fx.u("/apps/kass")) |
| 411 | if status != http.StatusOK { |
| 412 | t.Fatalf("overview page = %d:\n%s", status, body) |
| 413 | } |
| 414 | if !strings.Contains(body, `class="tile"`) { |
| 415 | t.Fatalf("no tiles on the Overview:\n%s", body) |
| 416 | } |
| 417 | // The fixture's stable holds v1 — the number the headline exists to show. |
| 418 | if !strings.Contains(body, "<code>v1</code>") { |
| 419 | t.Fatalf("the headline does not show what stable serves:\n%s", body) |
| 420 | } |
| 421 | // A channel pointer's promotion time does not say when each route adopted |
| 422 | // it, so the observed deployment summary must not present that timestamp |
| 423 | // as adoption provenance. |
| 424 | if strings.Contains(body, "published") { |
| 425 | t.Fatalf("the observed deployment invents provenance from a channel pointer:\n%s", body) |
| 426 | } |
| 427 | // The fixture's two domains need attention, which outranks everything |
| 428 | // else in healthVerdict — the headline verdict this page exists to show. |
| 429 | if !strings.Contains(body, "Needs attention") { |
| 430 | t.Fatalf("the headline verdict is missing:\n%s", body) |
| 431 | } |
| 432 | if !strings.Contains(body, "<h2>Running</h2>") { |
| 433 | t.Fatalf("no Running tile on the Overview:\n%s", body) |
| 434 | } |
| 435 | // "Machines" implied one computer per row when several rows routinely |
| 436 | // share a box, and its count was byte-for-byte the Web addresses count |
| 437 | // beside it. Both the word and the duplicate are meant to stay gone. |
| 438 | if strings.Contains(body, "Machines") || strings.Contains(body, "machines") { |
| 439 | t.Fatalf("the Overview still talks about machines:\n%s", body) |
| 440 | } |
| 441 | if strings.Contains(body, "stable pointer unreadable") { |
| 442 | t.Fatalf("stale tile copy still rendered:\n%s", body) |
| 443 | } |
| 444 | if strings.Contains(body, "Supply-chain bake") { |
| 445 | t.Fatalf("the Overview still says Supply-chain bake:\n%s", body) |
| 446 | } |
| 447 | if strings.Contains(body, `id="rung-`) { |
| 448 | t.Fatalf("the ladder is still rendered on the Overview:\n%s", body) |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | // flowSection returns just the diagram's markup. The console inlines its |
| 453 | // whole stylesheet into every page, so `.flow-stage.is-carried` and friends |
| 454 | // are present in the CSS on a page that draws no diagram at all — an |
| 455 | // unscoped Contains would assert on the rules instead of the drawing. |
| 456 | func flowSection(t *testing.T, page string) string { |
| 457 | t.Helper() |
| 458 | i := strings.Index(page, `<section class="flow"`) |
| 459 | if i < 0 { |
| 460 | t.Fatalf("no flow diagram on the page:\n%s", page) |
| 461 | } |
| 462 | j := strings.Index(page[i:], "</section>") |
| 463 | if j < 0 { |
| 464 | t.Fatalf("the flow section is never closed:\n%s", page[i:]) |
| 465 | } |
| 466 | return page[i : i+j] |
| 467 | } |
| 468 | |
| 469 | // The flow diagram is the Overview's answer to "what is going on" — the |
| 470 | // release path drawn as a path, with each address hanging off the channel |
| 471 | // that feeds it. These assertions cover what a reader has to be able to see; |
| 472 | // flow_test.go covers what the drawing is allowed to claim. |
| 473 | func TestOverviewDrawsTheFlow(t *testing.T) { |
| 474 | fx := newConsoleFixture(t) |
| 475 | c := signInPaul(t, fx) |
| 476 | _, _, page := get(t, c, fx.u("/apps/kass")) |
| 477 | |
| 478 | // Scoped to the section, deliberately: the page carries its stylesheet |
| 479 | // inline, so every class name this test looks for also appears in the |
| 480 | // CSS above it, and a whole-body assertion would pass on the rules |
| 481 | // rather than on the drawing. |
| 482 | body := flowSection(t, page) |
| 483 | // The whole path, including the steps this app has not reached: a path |
| 484 | // drawn only as far as the app has travelled reads as a path with no |
| 485 | // further to go. |
| 486 | for _, label := range []string{"you shipped", "edge", "beta", "live"} { |
| 487 | if !strings.Contains(body, `<p class="flow-label">`+label+"</p>") { |
| 488 | t.Fatalf("the flow is missing its %q box:\n%s", label, body) |
| 489 | } |
| 490 | } |
| 491 | // The addresses hang off the diagram, each with the same health word the |
| 492 | // Running tab would give it — and as real links, since the point of an |
| 493 | // address is that you can go to it. |
| 494 | if !strings.Contains(body, `<a href="https://kass.carlosapp.dev">kass.carlosapp.dev</a>`) { |
| 495 | t.Fatalf("the flow does not show the app's address as a link:\n%s", body) |
| 496 | } |
| 497 | // The fixture's silent host carries no Backing/Unit/Provisioned — a |
| 498 | // manually-added-shaped route the sweep was never told how to sample — |
| 499 | // so its silence is honest ignorance ("No readings"/idle), not an |
| 500 | // outage ("Not responding"/bad); TestFlowTonesAddressHealth in |
| 501 | // flow_test.go pins the "Not responding" -> bad mapping directly. |
| 502 | if !strings.Contains(body, `class="flow-addr flow-tone-idle"`) { |
| 503 | t.Fatalf("the fixture's silent, unstamped host should be toned idle (honest ignorance):\n%s", body) |
| 504 | } |
| 505 | // The fixture ships v2 but only has v1 live, so nothing has travelled the |
| 506 | // whole path: no step may claim it has. |
| 507 | if strings.Contains(body, "is-carried") { |
| 508 | t.Fatalf("v2 is not live, so no step carried it:\n%s", body) |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | // The Instances tab's one table, with the columns an owner reads across. |
| 513 | func TestOverviewInstancesPageRendersTable(t *testing.T) { |
| 514 | fx := newConsoleFixture(t) |
| 515 | c := signInPaul(t, fx) |
| 516 | |
| 517 | status, _, body := get(t, c, fx.u("/apps/kass/instances")) |
| 518 | if status != http.StatusOK { |
| 519 | t.Fatalf("instances page = %d:\n%s", status, body) |
| 520 | } |
| 521 | for _, th := range []string{"Address", "Health", "Version", "Channel", "CPU", "Memory"} { |
| 522 | if !strings.Contains(body, `<th scope="col">`+th+"</th>") { |
| 523 | t.Fatalf("the instances table has no %s column:\n%s", th, body) |
| 524 | } |
| 525 | } |
| 526 | // And the fixture's own routes are the rows — a header-only table would |
| 527 | // pass every assertion above. |
| 528 | if !strings.Contains(body, "kass.carlosapp.dev") || !strings.Contains(body, "<code>stable</code>") { |
| 529 | t.Fatalf("the app's routes are not listed in the table:\n%s", body) |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | func TestInstancesPageFilters(t *testing.T) { |
| 534 | fx := newConsoleFixture(t) |
| 535 | c := signInPaul(t, fx) |
| 536 | status, _, body := get(t, c, fx.u("/apps/kass/instances?q=zzz-no-such-host")) |
| 537 | if status != http.StatusOK || !strings.Contains(body, "No addresses match.") { |
| 538 | t.Fatalf("filtered-empty state missing (%d):\n%s", status, body) |
| 539 | } |
| 540 | status, _, body = get(t, c, fx.u("/apps/kass/instances?health=running")) |
| 541 | if status != http.StatusOK { |
| 542 | t.Fatalf("health filter = %d", status) |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | func TestOverviewVerdict(t *testing.T) { |
| 547 | cases := []struct { |
| 548 | name string |
| 549 | st OverviewStats |
| 550 | verdict string |
| 551 | label string |
| 552 | }{ |
| 553 | {"all good", OverviewStats{Deployment: DeploymentStatus{RouteCount: 2, ReportableCount: 2, ReportedCount: 2}, InstanceExpected: 2, InstanceCounted: 2, InstanceReporting: 2}, "ok", "All good"}, |
| 554 | {"asleep counts as accounted for", OverviewStats{Deployment: DeploymentStatus{RouteCount: 2, ReportableCount: 2, ReportedCount: 2}, InstanceExpected: 2, InstanceCounted: 2, InstanceReporting: 1, InstanceAsleep: 1}, "ok", "All good"}, |
| 555 | {"silent instance", OverviewStats{Deployment: DeploymentStatus{RouteCount: 2, ReportableCount: 2, ReportedCount: 2}, InstanceExpected: 2, InstanceCounted: 2, InstanceReporting: 1}, "attention", "Needs attention"}, |
| 556 | {"domain attention", OverviewStats{Deployment: DeploymentStatus{RouteCount: 1, ReportableCount: 1, ReportedCount: 1}, InstanceExpected: 1, InstanceCounted: 1, InstanceReporting: 1, DomainAttention: 1}, "attention", "Needs attention"}, |
| 557 | {"not deployed", OverviewStats{}, "notdeployed", "Not deployed yet"}, |
| 558 | {"route version unknown", OverviewStats{Deployment: DeploymentStatus{RouteCount: 1, ReportableCount: 1, UnknownCount: 1}}, "unknown", "Can't tell right now"}, |
| 559 | {"partial route versions", OverviewStats{Deployment: DeploymentStatus{RouteCount: 2, ReportableCount: 2, ReportedCount: 1, UnknownCount: 1}, InstanceExpected: 2, InstanceCounted: 2, InstanceReporting: 2}, "unknown", "Can't tell right now"}, |
| 560 | {"attention outranks partial versions", OverviewStats{Deployment: DeploymentStatus{RouteCount: 2, ReportableCount: 2, ReportedCount: 1, UnknownCount: 1}, InstanceExpected: 2, InstanceCounted: 2, InstanceReporting: 1}, "attention", "Needs attention"}, |
| 561 | {"sweep failed with instances expected", OverviewStats{Deployment: DeploymentStatus{RouteCount: 1, ReportableCount: 1, ReportedCount: 1}, InstanceExpected: 1, MetricsUnavailable: true}, "unknown", "Can't tell right now"}, |
| 562 | {"static-only app has nothing expected", OverviewStats{Deployment: DeploymentStatus{RouteCount: 1}, InstanceExpected: 0, MetricsUnavailable: true}, "ok", "All good"}, |
| 563 | } |
| 564 | for _, c := range cases { |
| 565 | v, l := healthVerdict(c.st) |
| 566 | if v != c.verdict || l != c.label { |
| 567 | t.Errorf("%s: got %q/%q, want %q/%q", c.name, v, l, c.verdict, c.label) |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | func TestOverviewAndAppListAgreeWhenFailedRouteHasNoVersion(t *testing.T) { |
| 573 | view := AppView{App: "kass", Routes: []RouteView{{ |
| 574 | Host: "kass.example", Account: "bab", Kind: "instance", Status: "failed", Provisioned: true, |
| 575 | }}} |
| 576 | row := summarize(view, "bab") |
| 577 | overview := assembleOverview(&view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 578 | if row.Verdict != "attention" || overview.Verdict != "attention" { |
| 579 | t.Fatalf("list=%q overview=%q, want attention on both pages", row.Verdict, overview.Verdict) |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | func TestOverviewIgnoresPlatformAliasWithoutInventingStaticVersion(t *testing.T) { |
| 584 | view := AppView{ |
| 585 | App: "site", |
| 586 | Routes: []RouteView{ |
| 587 | {Host: "site.example", Account: "bab", Kind: "static", Channel: "edge"}, |
| 588 | {Host: "site.bab.oncarlos.com", Account: "bab", Platform: true}, |
| 589 | }, |
| 590 | Channels: []ChannelView{{Name: "edge", Version: "site-v3"}}, |
| 591 | } |
| 592 | st := assembleOverview(&view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 593 | if st.Verdict != "ok" || st.Deployment.RouteCount != 1 || st.Deployment.ReportableCount != 0 || st.Deployment.HasReportedVersion() { |
| 594 | t.Fatalf("overview = %+v, want a healthy static deployment with no invented observation", st) |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | func TestServiceOnlyAppIsPresentAndHealthyOnBothPages(t *testing.T) { |
| 599 | view := AppView{App: "proxy", Routes: []RouteView{{Host: "proxy.example", Account: "bab", Kind: "service", Status: "ready"}}} |
| 600 | row := summarize(view, "bab") |
| 601 | overview := assembleOverview(&view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 602 | if row.Verdict != "ok" || overview.Verdict != "ok" || !overview.Deployment.HasRoutes() || overview.Deployment.ReportableCount != 0 { |
| 603 | t.Fatalf("list=%+v overview=%+v, want a present healthy service with no version report", row, overview) |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | func TestStaticPlusSilentInstanceIsUnknownOnBothPages(t *testing.T) { |
| 608 | view := AppView{App: "mixed-kind", Routes: []RouteView{ |
| 609 | {Host: "site.example", Account: "bab", Kind: "static"}, |
| 610 | {Host: "app.example", Account: "bab", Kind: "instance"}, |
| 611 | }} |
| 612 | row := summarize(view, "bab") |
| 613 | overview := assembleOverview(&view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 614 | if row.Verdict != "unknown" || overview.Verdict != "unknown" { |
| 615 | t.Fatalf("list=%q overview=%q, want unknown on both pages", row.Verdict, overview.Verdict) |
| 616 | } |
| 617 | if got := overview.Deployment.ReportingText(); got != "0 of 1 instances report a version." { |
| 618 | t.Fatalf("reporting text = %q", got) |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | func TestPlatformOnlyFailureDoesNotCreateCrossPageAttention(t *testing.T) { |
| 623 | view := AppView{App: "alias", Routes: []RouteView{{ |
| 624 | Host: "alias.bab.oncarlos.com", Account: "bab", Platform: true, Status: "failed", |
| 625 | }}, Domains: []DomainView{{Guidance: "ignored platform guidance"}}} |
| 626 | row := summarize(view, "bab") |
| 627 | overview := assembleOverview(&view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 628 | if row.Verdict != "notdeployed" || overview.Verdict != "notdeployed" { |
| 629 | t.Fatalf("list=%q overview=%q, want notdeployed on both pages", row.Verdict, overview.Verdict) |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | func TestOverviewExpectedCountsInstanceKindOnly(t *testing.T) { |
| 634 | view := &AppView{App: "kass", Routes: []RouteView{ |
| 635 | {Host: "a", Account: "bab", Kind: "instance"}, |
| 636 | {Host: "b", Account: "bab", Kind: "static"}, |
| 637 | {Host: "c", Account: "other", Kind: "instance"}, |
| 638 | }} |
| 639 | st := assembleOverview(view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 640 | if st.InstanceExpected != 1 { |
| 641 | t.Errorf("InstanceExpected = %d, want 1 (instance-kind, this account only)", st.InstanceExpected) |
| 642 | } |
| 643 | if st.Verdict == "" || st.VerdictLabel == "" { |
| 644 | t.Error("assembleOverview must fill Verdict and VerdictLabel") |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | // TestOverviewCountsSidecarsSeparately: a sidecar is not an "instance" for |
| 649 | // the Running tile's purposes — it never serves a request and is never |
| 650 | // static either, so lumping it into InstanceTotal makes a sidecar-bearing |
| 651 | // app's tile lie (InstanceExpected stays 0, and the template reads that as |
| 652 | // "static — nothing to run"). Sidecars get their own counter instead. |
| 653 | func TestOverviewCountsSidecarsSeparately(t *testing.T) { |
| 654 | view := &AppView{App: "eleven", Routes: []RouteView{ |
| 655 | {Host: "a", Account: "bab", Kind: "instance"}, |
| 656 | {Host: "bot.eleven.bab.sidecar.internal", Account: "bab", Kind: "sidecar"}, |
| 657 | {Host: "bot2.eleven.bab.sidecar.internal", Account: "bab", Kind: "sidecar"}, |
| 658 | // Another account's sidecar must not count here either. |
| 659 | {Host: "bot.eleven.other.sidecar.internal", Account: "other", Kind: "sidecar"}, |
| 660 | }} |
| 661 | st := assembleOverview(view, "bab", []InstanceMetrics{}, nil, boxJoin{}) |
| 662 | if st.InstanceTotal != 1 { |
| 663 | t.Errorf("InstanceTotal = %d, want 1 — sidecars must not inflate it", st.InstanceTotal) |
| 664 | } |
| 665 | if st.SidecarTotal != 2 { |
| 666 | t.Errorf("SidecarTotal = %d, want 2 (this account's sidecars only)", st.SidecarTotal) |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | // TestOverviewDBSizeSumsEveryRouteRegardlessOfReporting: a hibernating |
| 671 | // instance's database is still sitting on disk even though the metrics |
| 672 | // sweep hears nothing from it, so the Database tile's size must come from |
| 673 | // the account's ROUTES (via dbJoin, the same status.BoxMetrics.RouteDBBytes |
| 674 | // join the instances/routes APIs already use), not be gated on the sweep |
| 675 | // the way CPU/Mem are. It must also stay tenant-scoped like every other |
| 676 | // number assembleOverview produces. |
| 677 | func TestOverviewDBSizeSumsEveryRouteRegardlessOfReporting(t *testing.T) { |
| 678 | view := &AppView{App: "ips", Routes: []RouteView{ |
| 679 | {Host: "a", Account: "bab", Kind: "instance"}, |
| 680 | {Host: "b", Account: "bab", Kind: "instance", Hibernate: true}, |
| 681 | {Host: "c", Account: "bab", Kind: "instance"}, // no sized database |
| 682 | {Host: "theirs", Account: "other", Kind: "instance"}, |
| 683 | }} |
| 684 | join := boxJoin{dbBytes: map[string]int64{ |
| 685 | "a": 1 << 20, |
| 686 | "b": 2 << 20, // asleep, unreported by the sweep, still on disk |
| 687 | "theirs": 99 << 20, |
| 688 | }} |
| 689 | st := assembleOverview(view, "bab", nil, nil, join) |
| 690 | if st.DBSizeSum == nil || *st.DBSizeSum != 3<<20 { |
| 691 | t.Fatalf("DBSizeSum = %v, want 3MiB (a+b only — hibernating counts, another account never does)", st.DBSizeSum) |
| 692 | } |
| 693 | |
| 694 | none := assembleOverview(&AppView{App: "kass", Routes: []RouteView{{Host: "x", Account: "bab", Kind: "instance"}}}, "bab", nil, nil, boxJoin{}) |
| 695 | if none.DBSizeSum != nil { |
| 696 | t.Fatalf("DBSizeSum = %v with no route sized, want nil so the tile shows the em-dash", none.DBSizeSum) |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | // TestAppPageShowsPartialMismatchNotFullAlarm guards the boundary |
| 701 | // AllMismatched exists to draw: when only SOME of an app's routes disagree |
| 702 | // with the viewed account, the page must name the disagreeing route(s), not |
| 703 | // claim the whole app is not deploying — the false alarm task 4 was written |
| 704 | // to retire (2026-08-10 tito incident, see the MismatchedRoute doc comment). |
| 705 | func TestAppPageShowsPartialMismatchNotFullAlarm(t *testing.T) { |
| 706 | fx := newConsoleFixture(t) |
| 707 | c := signInPaul(t, fx) |
| 708 | |
| 709 | reg, err := registry.Open(fx.regPath) |
| 710 | if err != nil { |
| 711 | t.Fatal(err) |
| 712 | } |
| 713 | moved := testAccountID() |
| 714 | sqid := accountSqid(moved) |
| 715 | if err := fx.st.CreateAccount(moved, sqid, "Kass", "paul@keymail.dev", time.Now()); err != nil { |
| 716 | t.Fatal(err) |
| 717 | } |
| 718 | if err := fx.st.AddMember(moved, "paul@keymail.dev", RoleOwner, time.Now()); err != nil { |
| 719 | t.Fatal(err) |
| 720 | } |
| 721 | // Only ONE of kass's two fixture routes moves (kass.carlosapp.dev); |
| 722 | // docs.kass.carlosapp.dev stays on ops — a partial mismatch, not a full |
| 723 | // one. |
| 724 | if err := reg.SetAccount("kass.carlosapp.dev", sqid); err != nil { |
| 725 | t.Fatal(err) |
| 726 | } |
| 727 | reg.Close() |
| 728 | |
| 729 | _, _, body := get(t, c, fx.u("/apps/kass")) |
| 730 | if strings.Contains(body, "This app is not deploying") { |
| 731 | t.Errorf("a partial mismatch must not render the full-alarm copy:\n%s", body) |
| 732 | } |
| 733 | if !strings.Contains(body, `/account-review`) { |
| 734 | t.Errorf("the partial-mismatch banner does not link to diagnostics:\n%s", body) |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | // TestAppOverviewDatabaseTileRenders: the tile shows the sized database from |
| 739 | // a fresh box's status, and says so plainly when nothing has been sized. |
| 740 | func TestAppOverviewDatabaseTileRenders(t *testing.T) { |
| 741 | fx := newConsoleFixture(t) |
| 742 | fx.addRoute(t, registry.Route{Host: "owned.example.com", Kind: "instance", |
| 743 | Status: "ready", App: "kass", Backing: registry.BackingUnit}) |
| 744 | c := signInPaul(t, fx) |
| 745 | |
| 746 | _, _, body := get(t, c, fx.u("/apps/kass")) |
| 747 | if !strings.Contains(body, "<h2>Database</h2>") || !strings.Contains(body, "no size reported yet") { |
| 748 | t.Fatalf("unsized app: want the Database tile saying no size yet in:\n%s", body) |
| 749 | } |
| 750 | |
| 751 | box := status.CollectBox(nil, status.Probes{MachineID: "box1"}, time.Now()) |
| 752 | box.Metrics = &status.BoxMetrics{RouteDBBytes: map[string]int64{"owned.example.com": 3 << 20}} |
| 753 | if err := status.WriteBox(context.Background(), fx.rel, box); err != nil { |
| 754 | t.Fatal(err) |
| 755 | } |
| 756 | _, _, body = get(t, c, fx.u("/apps/kass")) |
| 757 | if !strings.Contains(body, "3.0 MB") || !strings.Contains(body, "on disk, including copies that are asleep") { |
| 758 | t.Fatalf("sized app: want 3.0 MB on the Database tile in:\n%s", body) |
| 759 | } |
| 760 | } |
| 761 | |