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 , 'Exec driver not 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 , 'Exec driver not native' )
328
331
class TestStartContainerReadOnlyFs (BaseTestCase ):
329
332
def runTest (self ):
330
333
# Presumably a bug in 1.5.0
@@ -585,7 +588,8 @@ def runTest(self):
585
588
self .assertIn ('State' , container_info )
586
589
state = container_info ['State' ]
587
590
self .assertIn ('ExitCode' , state )
588
- self .assertNotEqual (state ['ExitCode' ], 0 )
591
+ if EXEC_DRIVER_IS_NATIVE :
592
+ self .assertNotEqual (state ['ExitCode' ], 0 )
589
593
self .assertIn ('Running' , state )
590
594
self .assertEqual (state ['Running' ], False )
591
595
@@ -602,7 +606,8 @@ def runTest(self):
602
606
self .assertIn ('State' , container_info )
603
607
state = container_info ['State' ]
604
608
self .assertIn ('ExitCode' , state )
605
- self .assertNotEqual (state ['ExitCode' ], 0 )
609
+ if EXEC_DRIVER_IS_NATIVE :
610
+ self .assertNotEqual (state ['ExitCode' ], 0 )
606
611
self .assertIn ('Running' , state )
607
612
self .assertEqual (state ['Running' ], False )
608
613
@@ -618,7 +623,8 @@ def runTest(self):
618
623
self .assertIn ('State' , container_info )
619
624
state = container_info ['State' ]
620
625
self .assertIn ('ExitCode' , state )
621
- self .assertNotEqual (state ['ExitCode' ], 0 )
626
+ if EXEC_DRIVER_IS_NATIVE :
627
+ self .assertNotEqual (state ['ExitCode' ], 0 )
622
628
self .assertIn ('Running' , state )
623
629
self .assertEqual (state ['Running' ], False )
624
630
@@ -634,7 +640,8 @@ def runTest(self):
634
640
self .assertIn ('State' , container_info )
635
641
state = container_info ['State' ]
636
642
self .assertIn ('ExitCode' , state )
637
- self .assertNotEqual (state ['ExitCode' ], 0 )
643
+ if EXEC_DRIVER_IS_NATIVE :
644
+ self .assertNotEqual (state ['ExitCode' ], 0 )
638
645
self .assertIn ('Running' , state )
639
646
self .assertEqual (state ['Running' ], False )
640
647
@@ -982,6 +989,7 @@ def runTest(self):
982
989
self .client .remove_container (id , force = True )
983
990
984
991
992
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE , 'Exec driver not native' )
985
993
class TestExecuteCommand (BaseTestCase ):
986
994
def runTest (self ):
987
995
container = self .client .create_container ('busybox' , 'cat' ,
@@ -995,6 +1003,7 @@ def runTest(self):
995
1003
self .assertEqual (res , expected )
996
1004
997
1005
1006
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE , 'Exec driver not native' )
998
1007
class TestExecuteCommandString (BaseTestCase ):
999
1008
def runTest (self ):
1000
1009
container = self .client .create_container ('busybox' , 'cat' ,
@@ -1008,6 +1017,7 @@ def runTest(self):
1008
1017
self .assertEqual (res , expected )
1009
1018
1010
1019
1020
+ @unittest .skipIf (not EXEC_DRIVER_IS_NATIVE , 'Exec driver not native' )
1011
1021
class TestExecuteCommandStreaming (BaseTestCase ):
1012
1022
def runTest (self ):
1013
1023
container = self .client .create_container ('busybox' , 'cat' ,
@@ -1462,5 +1472,7 @@ def test_443(self):
1462
1472
if __name__ == '__main__' :
1463
1473
c = docker .Client (base_url = DEFAULT_BASE_URL )
1464
1474
c .pull ('busybox' )
1475
+ exec_driver = c .info ()['ExecutionDriver' ]
1476
+ EXEC_DRIVER_IS_NATIVE = exec_driver .startswith ('native' )
1465
1477
c .close ()
1466
1478
unittest .main ()
0 commit comments