Skip to content

Commit

Permalink
fix unit tests per spec
Browse files Browse the repository at this point in the history
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
  • Loading branch information
chanwit committed Dec 19, 2015
1 parent 6798d06 commit c51a6c2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libcontainer/cgroups/fs/blkio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestBlkioSetWeight(t *testing.T) {
"blkio.weight": strconv.Itoa(weightBefore),
})

helper.CgroupData.config.Resources.BlkioWeight = weightAfter
*helper.CgroupData.config.Resources.BlkioWeight = weightAfter
blkio := &BlkioGroup{}
if err := blkio.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down
10 changes: 5 additions & 5 deletions libcontainer/cgroups/fs/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestCpuSetShares(t *testing.T) {
"cpu.shares": strconv.Itoa(sharesBefore),
})

helper.CgroupData.config.Resources.CpuShares = sharesAfter
*helper.CgroupData.config.Resources.CpuShares = sharesAfter
cpu := &CpuGroup{}
if err := cpu.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -61,10 +61,10 @@ func TestCpuSetBandWidth(t *testing.T) {
"cpu.rt_period_us": strconv.Itoa(rtPeriodBefore),
})

helper.CgroupData.config.Resources.CpuQuota = quotaAfter
helper.CgroupData.config.Resources.CpuPeriod = periodAfter
helper.CgroupData.config.Resources.CpuRtRuntime = rtRuntimeAfter
helper.CgroupData.config.Resources.CpuRtPeriod = rtPeriodAfter
*helper.CgroupData.config.Resources.CpuQuota = quotaAfter
*helper.CgroupData.config.Resources.CpuPeriod = periodAfter
*helper.CgroupData.config.Resources.CpuRtRuntime = rtRuntimeAfter
*helper.CgroupData.config.Resources.CpuRtPeriod = rtPeriodAfter
cpu := &CpuGroup{}
if err := cpu.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions libcontainer/cgroups/fs/cpuset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestCpusetSetCpus(t *testing.T) {
"cpuset.cpus": cpusBefore,
})

helper.CgroupData.config.Resources.CpusetCpus = cpusAfter
*helper.CgroupData.config.Resources.CpusetCpus = cpusAfter
cpuset := &CpusetGroup{}
if err := cpuset.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -48,7 +48,7 @@ func TestCpusetSetMems(t *testing.T) {
"cpuset.mems": memsBefore,
})

helper.CgroupData.config.Resources.CpusetMems = memsAfter
*helper.CgroupData.config.Resources.CpusetMems = memsAfter
cpuset := &CpusetGroup{}
if err := cpuset.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down
10 changes: 5 additions & 5 deletions libcontainer/cgroups/fs/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func TestMemorySetMemory(t *testing.T) {
"memory.soft_limit_in_bytes": strconv.Itoa(reservationBefore),
})

helper.CgroupData.config.Resources.Memory = memoryAfter
helper.CgroupData.config.Resources.MemoryReservation = reservationAfter
*helper.CgroupData.config.Resources.Memory = memoryAfter
*helper.CgroupData.config.Resources.MemoryReservation = reservationAfter
memory := &MemoryGroup{}
if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -70,7 +70,7 @@ func TestMemorySetMemoryswap(t *testing.T) {
"memory.memsw.limit_in_bytes": strconv.Itoa(memoryswapBefore),
})

helper.CgroupData.config.Resources.MemorySwap = memoryswapAfter
*helper.CgroupData.config.Resources.MemorySwap = memoryswapAfter
memory := &MemoryGroup{}
if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestMemorySetKernelMemory(t *testing.T) {
"memory.kmem.limit_in_bytes": strconv.Itoa(kernelMemoryBefore),
})

helper.CgroupData.config.Resources.KernelMemory = kernelMemoryAfter
*helper.CgroupData.config.Resources.KernelMemory = kernelMemoryAfter
memory := &MemoryGroup{}
if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestMemorySetMemorySwappinessDefault(t *testing.T) {
"memory.swappiness": strconv.Itoa(swappinessBefore),
})

helper.CgroupData.config.Resources.Memory = swappinessAfter
*helper.CgroupData.config.Resources.Memory = swappinessAfter
memory := &MemoryGroup{}
if err := memory.Set(helper.CgroupPath, helper.CgroupData.config); err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions libcontainer/integration/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func testCpuShares(t *testing.T, systemd bool) {
if systemd {
config.Cgroups.Parent = "system.slice"
}
config.Cgroups.Resources.CpuShares = 1
*config.Cgroups.Resources.CpuShares = 1

_, _, err = runContainer(config, "", "ps")
if err == nil {
Expand Down Expand Up @@ -548,7 +548,7 @@ func testRunWithKernelMemory(t *testing.T, systemd bool) {
if systemd {
config.Cgroups.Parent = "system.slice"
}
config.Cgroups.Resources.KernelMemory = 52428800
*config.Cgroups.Resources.KernelMemory = 52428800

_, _, err = runContainer(config, "", "ps")
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion libcontainer/integration/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func newTemplateConfig(rootfs string) *configs.Config {
Name: "test",
Parent: "integration",
Resources: &configs.Resources{
MemorySwappiness: -1,
AllowAllDevices: false,
AllowedDevices: configs.DefaultAllowedDevices,
},
Expand Down

0 comments on commit c51a6c2

Please sign in to comment.