Ejemplo n.º 1
0
func TestBlockIOWeight() string {
	var testResourceBlockIO specs.Resources = specs.Resources{
		BlockIO: specs.BlockIO{
			Weight:                  300,
			WeightDevice:            nil,
			ThrottleReadBpsDevice:   nil,
			ThrottleWriteBpsDevice:  nil,
			ThrottleReadIOPSDevice:  nil,
			ThrottleWriteIOPSDevice: nil,
		},
	}
	linuxspec, linuxruntimespec := setResources(testResourceBlockIO)
	failinfo := "BlockIO Weight"
	c := make(chan bool)
	go func() {
		testResources(&linuxspec, &linuxruntimespec)
		close(c)
	}()
	result, err := checkConfigurationFromHost("blkio", "blkio.weight", "300", failinfo)
	<-c
	var testResult manager.TestResult
	testResult.Set("TestBlockIOWeight", testResourceBlockIO.BlockIO, err, result)
	adaptor.DeleteRun()
	return testResult.Marshal()
}
Ejemplo n.º 2
0
func TestCpuQuota() string {
	var testResourceCPU specs.Resources = specs.Resources{
		CPU: specs.CPU{
			Shares:          0,
			Quota:           20000,
			Period:          0,
			RealtimeRuntime: 0,
			RealtimePeriod:  0,
			Cpus:            "",
			Mems:            "",
		},
	}
	linuxspec, linuxruntimespec := setResources(testResourceCPU)
	failinfo := "CPU Quota"
	c := make(chan bool)
	go func() {
		testResources(&linuxspec, &linuxruntimespec)
		close(c)
	}()
	result, err := checkConfigurationFromHost("cpu", "cpu.cfs_quota_us", "20000", failinfo)
	<-c
	var testResult manager.TestResult
	testResult.Set("TestMemoryLimit", testResourceCPU.CPU, err, result)
	adaptor.DeleteRun()
	return testResult.Marshal()
}
func TestLinuxApparmorProfile() string {
	apparmorfile := "testapporprofile"
	linuxspec, linuxruntimespec := setApparmorProfile(apparmorfile)
	result, err := testApparmorProfile(&linuxspec, &linuxruntimespec)
	adaptor.DeleteRun()
	var testResult manager.TestResult
	testResult.Set("TestLinuxApparmorProfile", linuxRuntimeSpec.Linux.ApparmorProfile, err, result)
	return testResult.Marshal()
}
Ejemplo n.º 4
0
func TestHugepageLimit() string {
	var testResourcehugtlb specs.Resources = specs.Resources{
		HugepageLimits: []specs.HugepageLimit{
			{
				Pagesize: "2MB",
				Limit:    409600,
			},
		},
	}
	linuxspec, linuxruntimespec := setResources(testResourcehugtlb)
	failinfo := "Hugepage Limit"
	c := make(chan bool)
	go func() {
		testResources(&linuxspec, &linuxruntimespec)
		close(c)
	}()
	result, err := checkConfigurationFromHost("hugetlb", "hugetlb."+testResourcehugtlb.HugepageLimits[0].Pagesize+".limit_in_bytes", "409600", failinfo)
	<-c
	var testResult manager.TestResult
	testResult.Set("TestHugepageLimit", testResourcehugtlb.HugepageLimits, err, result)
	adaptor.DeleteRun()
	return testResult.Marshal()
}
Ejemplo n.º 5
0
func TestMemoryLimit() string {
	var testResourceseMemory specs.Resources = specs.Resources{
		Memory: specs.Memory{
			Limit:       204800,
			Reservation: 0,
			Swap:        0,
			Kernel:      0,
			Swappiness:  -1,
		},
	}
	linuxspec, linuxruntimespec := setResources(testResourceseMemory)
	failinfo := "Memory Limit"
	c := make(chan bool)
	go func() {
		testResources(&linuxspec, &linuxruntimespec)
		close(c)
	}()
	result, err := checkConfigurationFromHost("memory", "memory.limit_in_bytes", "204800", failinfo)
	<-c
	var testResult manager.TestResult
	testResult.Set("TestMemoryLimit", testResourceseMemory.Memory, err, result)
	adaptor.DeleteRun()
	return testResult.Marshal()
}