32
32
# export; history; import_image; insert; port; push; tag; get; load; stats;
33
33
34
34
DEFAULT_BASE_URL = os .environ .get ('DOCKER_HOST' )
35
+ EXEC_DRIVER_IS_NATIVE = True
35
36
36
37
warnings .simplefilter ('error' )
37
38
create_host_config = docker .utils .create_host_config
@@ -312,6 +313,7 @@ def runTest(self):
312
313
self .assertFalse (inspect_data ['VolumesRW' ][mount_dest ])
313
314
314
315
316
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE )
315
317
class TestCreateContainerReadOnlyFs (BaseTestCase ):
316
318
def runTest (self ):
317
319
ctnr = self .client .create_container (
@@ -325,6 +327,7 @@ def runTest(self):
325
327
self .assertNotEqual (res , 0 )
326
328
327
329
330
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE )
328
331
class TestStartContainerReadOnlyFs (BaseTestCase ):
329
332
def runTest (self ):
330
333
# Presumably a bug in 1.5.0
@@ -581,7 +584,8 @@ def runTest(self):
581
584
self .assertIn ('State' , container_info )
582
585
state = container_info ['State' ]
583
586
self .assertIn ('ExitCode' , state )
584
- self .assertNotEqual (state ['ExitCode' ], 0 )
587
+ if EXEC_DRIVER_IS_NATIVE :
588
+ self .assertNotEqual (state ['ExitCode' ], 0 )
585
589
self .assertIn ('Running' , state )
586
590
self .assertEqual (state ['Running' ], False )
587
591
@@ -598,7 +602,8 @@ def runTest(self):
598
602
self .assertIn ('State' , container_info )
599
603
state = container_info ['State' ]
600
604
self .assertIn ('ExitCode' , state )
601
- self .assertNotEqual (state ['ExitCode' ], 0 )
605
+ if EXEC_DRIVER_IS_NATIVE :
606
+ self .assertNotEqual (state ['ExitCode' ], 0 )
602
607
self .assertIn ('Running' , state )
603
608
self .assertEqual (state ['Running' ], False )
604
609
@@ -614,7 +619,8 @@ def runTest(self):
614
619
self .assertIn ('State' , container_info )
615
620
state = container_info ['State' ]
616
621
self .assertIn ('ExitCode' , state )
617
- self .assertNotEqual (state ['ExitCode' ], 0 )
622
+ if EXEC_DRIVER_IS_NATIVE :
623
+ self .assertNotEqual (state ['ExitCode' ], 0 )
618
624
self .assertIn ('Running' , state )
619
625
self .assertEqual (state ['Running' ], False )
620
626
@@ -630,7 +636,8 @@ def runTest(self):
630
636
self .assertIn ('State' , container_info )
631
637
state = container_info ['State' ]
632
638
self .assertIn ('ExitCode' , state )
633
- self .assertNotEqual (state ['ExitCode' ], 0 )
639
+ if EXEC_DRIVER_IS_NATIVE :
640
+ self .assertNotEqual (state ['ExitCode' ], 0 )
634
641
self .assertIn ('Running' , state )
635
642
self .assertEqual (state ['Running' ], False )
636
643
@@ -978,6 +985,7 @@ def runTest(self):
978
985
self .client .remove_container (id , force = True )
979
986
980
987
988
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE )
981
989
class TestExecuteCommand (BaseTestCase ):
982
990
def runTest (self ):
983
991
container = self .client .create_container ('busybox' , 'cat' ,
@@ -991,6 +999,7 @@ def runTest(self):
991
999
self .assertEqual (res , expected )
992
1000
993
1001
1002
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE )
994
1003
class TestExecuteCommandString (BaseTestCase ):
995
1004
def runTest (self ):
996
1005
container = self .client .create_container ('busybox' , 'cat' ,
@@ -1004,6 +1013,7 @@ def runTest(self):
1004
1013
self .assertEqual (res , expected )
1005
1014
1006
1015
1016
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE )
1007
1017
class TestExecuteCommandStreaming (BaseTestCase ):
1008
1018
def runTest (self ):
1009
1019
container = self .client .create_container ('busybox' , 'cat' ,
@@ -1458,5 +1468,7 @@ def test_443(self):
1458
1468
if __name__ == '__main__' :
1459
1469
c = docker .Client (base_url = DEFAULT_BASE_URL )
1460
1470
c .pull ('busybox' )
1471
+ exec_driver = c .info ()['ExecutionDriver' ]
1472
+ EXEC_DRIVER_IS_NATIVE = exec_driver .startswith ('native' )
1461
1473
c .close ()
1462
1474
unittest .main ()
0 commit comments