diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-09-05 18:31:37 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-09-05 18:32:50 -0700 |
commit | 5f0002fc83a77a39d9a2ef1443bc6c18e22ea779 (patch) | |
tree | 136393f0552951b5da1399c8bb4161eea0e3b156 /runsc/test/testutil/docker.go | |
parent | 41b56696c4923276c6269812bb3dfa7643dab65d (diff) |
Use container's capabilities in exec
When no capabilities are specified in exec, use the
container's capabilities to match runc's behavior.
PiperOrigin-RevId: 211735186
Change-Id: Icd372ed64410c81144eae94f432dffc9fe3a86ce
Diffstat (limited to 'runsc/test/testutil/docker.go')
-rw-r--r-- | runsc/test/testutil/docker.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go index fc67c174a..c73bb0406 100644 --- a/runsc/test/testutil/docker.go +++ b/runsc/test/testutil/docker.go @@ -218,20 +218,20 @@ func (d *Docker) FindPort(sandboxPort int) (int, error) { // WaitForOutput calls 'docker logs' to retrieve containers output and searches // for the given pattern. -func (d *Docker) WaitForOutput(pattern string, timeout time.Duration) error { +func (d *Docker) WaitForOutput(pattern string, timeout time.Duration) (string, error) { re := regexp.MustCompile(pattern) var out string for exp := time.Now().Add(timeout); time.Now().Before(exp); { var err error out, err = do("logs", d.Name) if err != nil { - return err + return "", err } - if re.MatchString(out) { + if match := re.FindString(out); match != "" { // Success! - return nil + return match, nil } time.Sleep(100 * time.Millisecond) } - return fmt.Errorf("timeout waiting for output %q: %s", re.String(), out) + return "", fmt.Errorf("timeout waiting for output %q: %s", re.String(), out) } |