server: use uppercase per-upstream status in /health; verify in tests
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I26a71054250c71747e92c2803d8c39ed6a6a6964
This commit is contained in:
parent
985ed1090a
commit
a45ee57da7
2 changed files with 21 additions and 1 deletions
|
|
@ -431,6 +431,26 @@ func TestHealthEndpointDegraded(t *testing.T) {
|
|||
if len(resp.Upstreams) != 2 {
|
||||
t.Errorf("upstreams = %d, want 2", len(resp.Upstreams))
|
||||
}
|
||||
|
||||
var foundDegraded bool
|
||||
for _, u := range resp.Upstreams {
|
||||
if u.URL == "https://up2.example.com" && u.Status == "DEGRADED" {
|
||||
foundDegraded = true
|
||||
}
|
||||
}
|
||||
if !foundDegraded {
|
||||
t.Error("expected up2 to have status DEGRADED")
|
||||
}
|
||||
|
||||
var foundActive bool
|
||||
for _, u := range resp.Upstreams {
|
||||
if u.URL == "https://up1.example.com" && u.Status == "ACTIVE" {
|
||||
foundActive = true
|
||||
}
|
||||
}
|
||||
if !foundActive {
|
||||
t.Error("expected up1 to have status ACTIVE")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHealthEndpointAllDown(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue