Add test for cpu_cfs_period

This commit is contained in:
Daniele Valeriani 2018-07-16 22:43:34 +02:00
parent ec948f648d
commit b0a14caca2

View file

@ -2524,3 +2524,25 @@ func TestDockerImageRef(t *testing.T) {
})
}
}
func TestDockerDriver_CPUCFSPeriod(t *testing.T) {
if !tu.IsTravis() {
t.Parallel()
}
if !testutil.DockerIsConnected(t) {
t.Skip("Docker not connected")
}
task, _, _ := dockerTask(t)
task.Config["cpu_hard_limit"] = true
task.Config["cpu_cfs_period"] = 1000000
client, handle, cleanup := dockerSetup(t, task)
defer cleanup()
waitForExist(t, client, handle)
container, err := client.InspectContainer(handle.ContainerID())
assert.Nil(t, err, "Error inspecting container: %v", err)
assert.Equal(t, int64(1000000), container.HostConfig.CPUPeriod, "cpu_cfs_period option incorrectly set")
}