From f607052dfa2127069d5e7fb4354036f03d35b8af Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Fri, 15 Sep 2017 09:25:31 +0100 Subject: [PATCH] tests: Improve unit-test coverage for oci.go Update cgroup test TestProcessCgroupsPathAbsoluteNoCgroupMountDestinationFailure() to take account of new behaviour resulting from #553). Fixes #560. Signed-off-by: James O. D. Hunt --- oci_test.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/oci_test.go b/oci_test.go index 4c1a889f..b405b498 100644 --- a/oci_test.go +++ b/oci_test.go @@ -369,21 +369,23 @@ func TestProcessCgroupsPathAbsoluteNoCgroupMountDestinationFailure(t *testing.T) ociSpec := oci.CompatOCISpec{} - ociSpec.Linux = &specs.Linux{ - Resources: &specs.LinuxResources{ - Memory: &specs.LinuxMemory{}, - }, - CgroupsPath: absoluteCgroupsPath, - } - ociSpec.Mounts = []specs.Mount{ { Type: "cgroup", }, } - _, err := processCgroupsPath(ociSpec, true) - assert.Error(err, "This test should fail because no cgroup mount destination provided") + ociSpec.Linux = &specs.Linux{ + CgroupsPath: absoluteCgroupsPath, + } + + for _, d := range cgroupTestData { + ociSpec.Linux.Resources = d.linuxSpec + for _, isPod := range []bool{true, false} { + _, err := processCgroupsPath(ociSpec, isPod) + assert.Error(err, "This test should fail because no cgroup mount destination provided") + } + } } func TestProcessCgroupsPathAbsoluteSuccessful(t *testing.T) {