Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
tests: Improve unit-test coverage for oci.go
Browse files Browse the repository at this point in the history
Update cgroup test
TestProcessCgroupsPathAbsoluteNoCgroupMountDestinationFailure()
to take account of new behaviour resulting from #553).

Fixes #560.

Signed-off-by: James O. D. Hunt <[email protected]>
  • Loading branch information
jodh-intel committed Sep 15, 2017
1 parent 0f8ec51 commit f607052
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions oci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f607052

Please sign in to comment.