OPS-02: test-fix — overview-pruefung nur fuer eigene testziele, nicht alle jemals registrierten
This commit is contained in:
@@ -25,7 +25,6 @@ func setupTest(t *testing.T) (*Store, func()) {
|
||||
t.Fatalf("pool: %v", err)
|
||||
}
|
||||
if _, err := pool.Exec(ctx, `
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
CREATE TABLE IF NOT EXISTS status_targets (name TEXT PRIMARY KEY, health_url TEXT NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS status_history (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name TEXT NOT NULL, status TEXT NOT NULL,
|
||||
@@ -70,15 +69,18 @@ func TestOverview_ShowsAllRegisteredModules(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("overview: %v", err)
|
||||
}
|
||||
found := map[string]bool{}
|
||||
// Overview() listet ALLE jemals registrierten Ziele (auch aus fruehreren
|
||||
// Testlaeufen auf derselben geteilten Test-DB) — hier wird deshalb nur
|
||||
// der Status von nameA/nameB geprueft, nicht jeder Eintrag der Tabelle.
|
||||
statusByName := map[string]Status{}
|
||||
for _, m := range overview {
|
||||
found[m.Name] = true
|
||||
if m.Status != StatusUp {
|
||||
t.Fatalf("modul %s: status = %s, want up", m.Name, m.Status)
|
||||
}
|
||||
statusByName[m.Name] = m.Status
|
||||
}
|
||||
if !found[nameA] || !found[nameB] {
|
||||
t.Fatalf("erwartet beide module in der uebersicht, habe: %+v", overview)
|
||||
if statusByName[nameA] != StatusUp {
|
||||
t.Fatalf("modul %s: status = %s, want up", nameA, statusByName[nameA])
|
||||
}
|
||||
if statusByName[nameB] != StatusUp {
|
||||
t.Fatalf("modul %s: status = %s, want up", nameB, statusByName[nameB])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user