diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2019-08-29 09:55:13 -0700 |
---|---|---|
committer | Nicolas Lacasse <nlacasse@google.com> | 2019-08-29 14:00:18 -0700 |
commit | 6e8fc27dc5de8ed0a04fe943a6354c0133bfc63f (patch) | |
tree | 700a8164cd53b7a5eba5d0b9d4823af0d6ed10d2 /runsc/test/testutil | |
parent | 599136b25e0e506eada1800d84f5d5db7318a7ec (diff) |
Don't log an error when stopping the container if it is not running.
This removes a lot of confusing messages from the test logs.
PiperOrigin-RevId: 266164001
Diffstat (limited to 'runsc/test/testutil')
-rw-r--r-- | runsc/test/testutil/docker.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go index 3f3e191b0..94e625259 100644 --- a/runsc/test/testutil/docker.go +++ b/runsc/test/testutil/docker.go @@ -297,7 +297,11 @@ func (d *Docker) Remove() error { func (d *Docker) CleanUp() { d.logDockerID() if _, err := do("kill", d.Name); err != nil { - log.Printf("error killing container %q: %v", d.Name, err) + if strings.Contains(err.Error(), "is not running") { + // Nothing to kill. Don't log the error in this case. + } else { + log.Printf("error killing container %q: %v", d.Name, err) + } } if err := d.Remove(); err != nil { log.Print(err) |