summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/testutil/docker.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-09-28 15:51:36 -0700
committerShentubot <shentubot@google.com>2018-09-28 15:52:33 -0700
commit49ff81a42b51a3fa2ee139e1e86179fa0c427a86 (patch)
tree35194b1301a589cf5ff830f84f8b7c984f88f0a5 /runsc/test/testutil/docker.go
parent2496d9b4b6343154525f73e9583a4a60bebcfa30 (diff)
Add ruby image tests
PiperOrigin-RevId: 215009066 Change-Id: I54ab920fa649cf4d0817f7cb8ea76f9126523330
Diffstat (limited to 'runsc/test/testutil/docker.go')
-rw-r--r--runsc/test/testutil/docker.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go
index c73bb0406..d0446df4e 100644
--- a/runsc/test/testutil/docker.go
+++ b/runsc/test/testutil/docker.go
@@ -162,6 +162,11 @@ func (d *Docker) Run(args ...string) (string, error) {
return do(a...)
}
+// Logs calls 'docker logs'.
+func (d *Docker) Logs() (string, error) {
+ return do("logs", d.Name)
+}
+
// Exec calls 'docker exec' with the arguments provided.
func (d *Docker) Exec(args ...string) (string, error) {
a := []string{"exec", d.Name}
@@ -193,12 +198,14 @@ func (d *Docker) Remove() error {
return nil
}
-// CleanUp kills and deletes the container.
-func (d *Docker) CleanUp() error {
+// CleanUp kills and deletes the container (best effort).
+func (d *Docker) CleanUp() {
if _, err := do("kill", d.Name); err != nil {
- return fmt.Errorf("error killing container %q: %v", d.Name, err)
+ log.Printf("error killing container %q: %v", d.Name, err)
+ }
+ if err := d.Remove(); err != nil {
+ log.Print(err)
}
- return d.Remove()
}
// FindPort returns the host port that is mapped to 'sandboxPort'. This calls
@@ -223,7 +230,7 @@ func (d *Docker) WaitForOutput(pattern string, timeout time.Duration) (string, e
var out string
for exp := time.Now().Add(timeout); time.Now().Before(exp); {
var err error
- out, err = do("logs", d.Name)
+ out, err = d.Logs()
if err != nil {
return "", err
}