From d40d80106988e9302aaa354d4f58caa6c31429b4 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 11 Oct 2018 11:56:42 -0700 Subject: Sandbox cgroup tests Verify that cgroup is being properly set. PiperOrigin-RevId: 216736137 Change-Id: I0e27fd604eca67e7dd2e3548dc372ca9cc416309 --- runsc/test/testutil/docker.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runsc/test/testutil') 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) { -- cgit v1.2.3