Fix A (found live on 9202): the container sampler reads docker inspect JSON — a -f template stopped at 'no entry for key Health' for every app without a healthcheck, so a healthy restore read 'not started'. Commit only.
gates / gates (push) Successful in 1m27s
gates / gates (push) Successful in 1m27s
This commit is contained in:
@@ -20,3 +20,18 @@ func TestR1279_MainWiresTheImportsDownloadFirst(t *testing.T) {
|
||||
t.Fatal("main.go's stack adapter must read container samples for the stable-start rule (fix A)")
|
||||
}
|
||||
}
|
||||
|
||||
// Fix A: the sampler reads a container with NO healthcheck (no State.Health) — measured on 9202: a -f template stopped
|
||||
// at „map has no entry for key Health", so every such app read „not started".
|
||||
func TestFixA_ParseContainerSamples(t *testing.T) {
|
||||
out := []byte(`[{"Id":"a1","RestartCount":0,"State":{"Status":"running"}},
|
||||
{"Id":"b2","RestartCount":3,"State":{"Status":"running","Health":{"Status":"healthy"}}},
|
||||
{"Id":"c3","RestartCount":1,"State":{"Status":"restarting"}}]`)
|
||||
got, err := parseContainerSamples(out)
|
||||
if err != nil || len(got) != 3 {
|
||||
t.Fatalf("parse: %v %+v", err, got)
|
||||
}
|
||||
if !got[0].Running || got[0].Health != "" || got[1].Health != "healthy" || got[1].RestartCount != 3 || got[2].Running {
|
||||
t.Fatalf("wrong samples: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user