mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 19:51:39 +00:00
Improve logging in upgrade tests
This commit is contained in:
parent
bdaae060cc
commit
503d9c7586
@ -381,18 +381,22 @@ func runImage(dockerClient *client.Client, volumeName, version, imageID string)
|
|||||||
lastErr = nil
|
lastErr = nil
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if lastErr != nil {
|
logs, err := dockerClient.ContainerLogs(context.Background(), containerID, types.ContainerLogsOptions{
|
||||||
logs, err := dockerClient.ContainerLogs(context.Background(), containerID, types.ContainerLogsOptions{
|
ShowStdout: true,
|
||||||
ShowStdout: true,
|
ShowStderr: true,
|
||||||
ShowStderr: true,
|
Follow: true,
|
||||||
})
|
})
|
||||||
// ignore errors when cannot get logs, it's just for debugging anyways
|
// ignore errors when cannot get logs, it's just for debugging anyways
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logbody, err := io.ReadAll(logs)
|
go func() {
|
||||||
if err == nil {
|
for {
|
||||||
log.Printf("Container logs:\n\n%s\n\n", string(logbody))
|
if body, err := io.ReadAll(logs); err == nil && len(body) > 0 {
|
||||||
|
log.Printf("%s: %s", version, string(body))
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}()
|
||||||
}
|
}
|
||||||
return baseURL, containerID, lastErr
|
return baseURL, containerID, lastErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user