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

Commit

Permalink
Merge pull request #561 from jodh-intel/update-cgroup-tests
Browse files Browse the repository at this point in the history
tests: Improve unit-test coverage for oci.go
  • Loading branch information
Samuel Ortiz authored Sep 18, 2017
2 parents c9ccbb7 + f607052 commit f8f8c6c
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 f8f8c6c

Please sign in to comment.