mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-25 14:30:43 +01:00
test: keep docker errors in trino container diagnostics
Report docker inspect/logs failures instead of dropping them, and include the last docker exec output in the container-dead fatal so a missing container still explains what happened.
This commit is contained in:
1 parent
c871f3f6e6
commit
a32d021f6f
1 file changed
+5
-1
@@ -516,7 +516,7 @@ func waitForTrino(t *testing.T, containerName string, timeout time.Duration) {
|
||||
}
|
||||
|
||||
if containerDead {
|
||||
t.Fatalf("Trino container %s exited before becoming ready\n%s", containerName, trinoContainerDiagnostics(containerName))
|
||||
t.Fatalf("Trino container %s exited before becoming ready\nLast output:\n%s\n%s", containerName, string(lastOutput), trinoContainerDiagnostics(containerName))
|
||||
}
|
||||
t.Fatalf("Timed out waiting for Trino to be ready\nLast output:\n%s", string(lastOutput))
|
||||
}
|
||||
@@ -527,9 +527,13 @@ func trinoContainerDiagnostics(containerName string) string {
|
||||
"status={{.State.Status}} exitCode={{.State.ExitCode}} oomKilled={{.State.OOMKilled}} error={{.State.Error}}",
|
||||
containerName).CombinedOutput(); err == nil {
|
||||
fmt.Fprintf(&b, "docker inspect: %s\n", strings.TrimSpace(string(out)))
|
||||
} else {
|
||||
fmt.Fprintf(&b, "docker inspect failed: %v (%s)\n", err, strings.TrimSpace(string(out)))
|
||||
}
|
||||
if out, err := exec.Command("docker", "logs", "--tail", "80", containerName).CombinedOutput(); err == nil {
|
||||
fmt.Fprintf(&b, "docker logs:\n%s", string(out))
|
||||
} else {
|
||||
fmt.Fprintf(&b, "docker logs failed: %v (%s)", err, strings.TrimSpace(string(out)))
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user