@@ -286,6 +286,33 @@ def test_create_container_with_cpu_shares(self):
286
286
self .assertEqual (args [1 ]['headers' ],
287
287
{'Content-Type' : 'application/json' })
288
288
289
+ @requires_api_version ('1.18' )
290
+ def test_create_container_with_host_config_cpu_shares (self ):
291
+ self .client .create_container (
292
+ 'busybox' , 'ls' , host_config = self .client .create_host_config (
293
+ cpu_shares = 512
294
+ )
295
+ )
296
+
297
+ args = fake_request .call_args
298
+ self .assertEqual (args [0 ][1 ],
299
+ url_prefix + 'containers/create' )
300
+
301
+ self .assertEqual (json .loads (args [1 ]['data' ]),
302
+ json .loads ('''
303
+ {"Tty": false, "Image": "busybox",
304
+ "Cmd": ["ls"], "AttachStdin": false,
305
+ "AttachStderr": true,
306
+ "AttachStdout": true, "OpenStdin": false,
307
+ "StdinOnce": false,
308
+ "NetworkDisabled": false,
309
+ "HostConfig": {
310
+ "CpuShares": 512,
311
+ "NetworkMode": "default"
312
+ }}''' ))
313
+ self .assertEqual (args [1 ]['headers' ],
314
+ {'Content-Type' : 'application/json' })
315
+
289
316
def test_create_container_with_cpuset (self ):
290
317
self .client .create_container ('busybox' , 'ls' ,
291
318
cpuset = '0,1' )
@@ -306,6 +333,33 @@ def test_create_container_with_cpuset(self):
306
333
self .assertEqual (args [1 ]['headers' ],
307
334
{'Content-Type' : 'application/json' })
308
335
336
+ @requires_api_version ('1.18' )
337
+ def test_create_container_with_host_config_cpuset (self ):
338
+ self .client .create_container (
339
+ 'busybox' , 'ls' , host_config = self .client .create_host_config (
340
+ cpuset_cpus = '0,1'
341
+ )
342
+ )
343
+
344
+ args = fake_request .call_args
345
+ self .assertEqual (args [0 ][1 ],
346
+ url_prefix + 'containers/create' )
347
+
348
+ self .assertEqual (json .loads (args [1 ]['data' ]),
349
+ json .loads ('''
350
+ {"Tty": false, "Image": "busybox",
351
+ "Cmd": ["ls"], "AttachStdin": false,
352
+ "AttachStderr": true,
353
+ "AttachStdout": true, "OpenStdin": false,
354
+ "StdinOnce": false,
355
+ "NetworkDisabled": false,
356
+ "HostConfig": {
357
+ "CpuSetCpus": "0,1",
358
+ "NetworkMode": "default"
359
+ }}''' ))
360
+ self .assertEqual (args [1 ]['headers' ],
361
+ {'Content-Type' : 'application/json' })
362
+
309
363
def test_create_container_with_cgroup_parent (self ):
310
364
self .client .create_container (
311
365
'busybox' , 'ls' , host_config = self .client .create_host_config (
0 commit comments