@@ -255,7 +255,7 @@ def test_valid_log_driver_and_log_opt(self):
255
255
256
256
container = self .client .create_container (
257
257
'busybox' , ['true' ],
258
- host_config = self .client .create_host_config (log_config = config )
258
+ host_config = self .client .create_host_config (log_config = log_config )
259
259
)
260
260
self .tmp_containers .append (container ['Id' ])
261
261
self .client .start (container )
@@ -274,14 +274,53 @@ def test_invalid_log_driver_raises_exception(self):
274
274
275
275
container = self .client .create_container (
276
276
'busybox' , ['true' ],
277
- host_config = create_host_config (log_config = log_config )
277
+ host_config = self . client . create_host_config (log_config = log_config )
278
278
)
279
279
280
280
expected_msg = "logger: no log driver named 'asdf-nope' is registered"
281
281
with self .assertRaisesRegexp (APIError , expected_msg ):
282
282
# raises an internal server error 500
283
283
self .client .start (container )
284
284
285
+ @unittest .skip ("Reason: https://github.com/docker/docker/issues/15633" )
286
+ def test_valid_no_log_driver_specified (self ):
287
+ log_config = docker .utils .LogConfig (
288
+ type = "" ,
289
+ config = {'max-file' : '100' }
290
+ )
291
+
292
+ container = self .client .create_container (
293
+ 'busybox' , ['true' ],
294
+ host_config = self .client .create_host_config (log_config = log_config )
295
+ )
296
+ self .tmp_containers .append (container ['Id' ])
297
+ self .client .start (container )
298
+
299
+ info = self .client .inspect_container (container )
300
+ container_log_config = info ['HostConfig' ]['LogConfig' ]
301
+
302
+ self .assertEqual (container_log_config ['Type' ], "json-file" )
303
+ self .assertEqual (container_log_config ['Config' ], log_config .config )
304
+
305
+ def test_valid_no_config_specified (self ):
306
+ log_config = docker .utils .LogConfig (
307
+ type = "json-file" ,
308
+ config = None
309
+ )
310
+
311
+ container = self .client .create_container (
312
+ 'busybox' , ['true' ],
313
+ host_config = self .client .create_host_config (log_config = log_config )
314
+ )
315
+ self .tmp_containers .append (container ['Id' ])
316
+ self .client .start (container )
317
+
318
+ info = self .client .inspect_container (container )
319
+ container_log_config = info ['HostConfig' ]['LogConfig' ]
320
+
321
+ self .assertEqual (container_log_config ['Type' ], "json-file" )
322
+ self .assertEqual (container_log_config ['Config' ], {})
323
+
285
324
286
325
@unittest .skipIf (not EXEC_DRIVER_IS_NATIVE , 'Exec driver not native' )
287
326
class TestCreateContainerReadOnlyFs (BaseTestCase ):
0 commit comments