From 6e8fc27dc5de8ed0a04fe943a6354c0133bfc63f Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Thu, 29 Aug 2019 09:55:13 -0700 Subject: 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 --- runsc/test/testutil/docker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3