diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-10-11 11:56:42 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-11 11:58:15 -0700 |
commit | d40d80106988e9302aaa354d4f58caa6c31429b4 (patch) | |
tree | 8542738ab1a4c879b431dd5966f3d9940c650ecc /runsc/test/testutil/docker.go | |
parent | f413e4b11794cd71cc3b2b64c8f6861f5394a3f1 (diff) |
Sandbox cgroup tests
Verify that cgroup is being properly set.
PiperOrigin-RevId: 216736137
Change-Id: I0e27fd604eca67e7dd2e3548dc372ca9cc416309
Diffstat (limited to 'runsc/test/testutil/docker.go')
-rw-r--r-- | runsc/test/testutil/docker.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go index 2f15ab818..8a51d3eed 100644 --- a/runsc/test/testutil/docker.go +++ b/runsc/test/testutil/docker.go @@ -298,6 +298,15 @@ func (d *Docker) RootDirInHost() (string, error) { return strings.TrimSuffix(string(out), "\n"), nil } +// ID returns the container ID. +func (d *Docker) ID() (string, error) { + out, err := do("inspect", "-f={{.Id}}", d.Name) + if err != nil { + return "", fmt.Errorf("error retrieving ID: %v", err) + } + return strings.TrimSpace(string(out)), nil +} + // WaitForOutput calls 'docker logs' to retrieve containers output and searches // for the given pattern. func (d *Docker) WaitForOutput(pattern string, timeout time.Duration) (string, error) { |