summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-04-05 11:37:56 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-05 11:39:53 -0700
commit3007ae647d2e7a8800f3550f5ffc53c5e73415ce (patch)
tree21e2c62185ef3e6e7f457c095fabacd33fcac0ad /pkg
parent8161ed4110e283c7643c2bb534f136aaf816d1cf (diff)
Fail tests when container returns non-zero status
PiperOrigin-RevId: 366839955
Diffstat (limited to 'pkg')
-rw-r--r--pkg/test/dockerutil/container.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/test/dockerutil/container.go b/pkg/test/dockerutil/container.go
index 41fcf4978..06152a444 100644
--- a/pkg/test/dockerutil/container.go
+++ b/pkg/test/dockerutil/container.go
@@ -434,7 +434,14 @@ func (c *Container) Wait(ctx context.Context) error {
select {
case err := <-errChan:
return err
- case <-statusChan:
+ case res := <-statusChan:
+ if res.StatusCode != 0 {
+ var msg string
+ if res.Error != nil {
+ msg = res.Error.Message
+ }
+ return fmt.Errorf("container returned non-zero status: %d, msg: %q", res.StatusCode, msg)
+ }
return nil
}
}