mirror of https://github.com/docker/docker-py.git
Ensure integration tests work with LXC exec driver
This commit is contained in:
parent
5ce02b9f14
commit
e255c10f57
|
@ -32,6 +32,7 @@ from test import Cleanup
|
||||||
# export; history; import_image; insert; port; push; tag; get; load; stats;
|
# export; history; import_image; insert; port; push; tag; get; load; stats;
|
||||||
|
|
||||||
DEFAULT_BASE_URL = os.environ.get('DOCKER_HOST')
|
DEFAULT_BASE_URL = os.environ.get('DOCKER_HOST')
|
||||||
|
EXEC_DRIVER_IS_NATIVE = True
|
||||||
|
|
||||||
warnings.simplefilter('error')
|
warnings.simplefilter('error')
|
||||||
create_host_config = docker.utils.create_host_config
|
create_host_config = docker.utils.create_host_config
|
||||||
|
@ -312,6 +313,7 @@ class TestStartContainerWithRoBinds(BaseTestCase):
|
||||||
self.assertFalse(inspect_data['VolumesRW'][mount_dest])
|
self.assertFalse(inspect_data['VolumesRW'][mount_dest])
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE)
|
||||||
class TestCreateContainerReadOnlyFs(BaseTestCase):
|
class TestCreateContainerReadOnlyFs(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
ctnr = self.client.create_container(
|
ctnr = self.client.create_container(
|
||||||
|
@ -325,6 +327,7 @@ class TestCreateContainerReadOnlyFs(BaseTestCase):
|
||||||
self.assertNotEqual(res, 0)
|
self.assertNotEqual(res, 0)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE)
|
||||||
class TestStartContainerReadOnlyFs(BaseTestCase):
|
class TestStartContainerReadOnlyFs(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
# Presumably a bug in 1.5.0
|
# Presumably a bug in 1.5.0
|
||||||
|
@ -581,6 +584,7 @@ class TestStop(BaseTestCase):
|
||||||
self.assertIn('State', container_info)
|
self.assertIn('State', container_info)
|
||||||
state = container_info['State']
|
state = container_info['State']
|
||||||
self.assertIn('ExitCode', state)
|
self.assertIn('ExitCode', state)
|
||||||
|
if EXEC_DRIVER_IS_NATIVE:
|
||||||
self.assertNotEqual(state['ExitCode'], 0)
|
self.assertNotEqual(state['ExitCode'], 0)
|
||||||
self.assertIn('Running', state)
|
self.assertIn('Running', state)
|
||||||
self.assertEqual(state['Running'], False)
|
self.assertEqual(state['Running'], False)
|
||||||
|
@ -598,6 +602,7 @@ class TestStopWithDictInsteadOfId(BaseTestCase):
|
||||||
self.assertIn('State', container_info)
|
self.assertIn('State', container_info)
|
||||||
state = container_info['State']
|
state = container_info['State']
|
||||||
self.assertIn('ExitCode', state)
|
self.assertIn('ExitCode', state)
|
||||||
|
if EXEC_DRIVER_IS_NATIVE:
|
||||||
self.assertNotEqual(state['ExitCode'], 0)
|
self.assertNotEqual(state['ExitCode'], 0)
|
||||||
self.assertIn('Running', state)
|
self.assertIn('Running', state)
|
||||||
self.assertEqual(state['Running'], False)
|
self.assertEqual(state['Running'], False)
|
||||||
|
@ -614,6 +619,7 @@ class TestKill(BaseTestCase):
|
||||||
self.assertIn('State', container_info)
|
self.assertIn('State', container_info)
|
||||||
state = container_info['State']
|
state = container_info['State']
|
||||||
self.assertIn('ExitCode', state)
|
self.assertIn('ExitCode', state)
|
||||||
|
if EXEC_DRIVER_IS_NATIVE:
|
||||||
self.assertNotEqual(state['ExitCode'], 0)
|
self.assertNotEqual(state['ExitCode'], 0)
|
||||||
self.assertIn('Running', state)
|
self.assertIn('Running', state)
|
||||||
self.assertEqual(state['Running'], False)
|
self.assertEqual(state['Running'], False)
|
||||||
|
@ -630,6 +636,7 @@ class TestKillWithDictInsteadOfId(BaseTestCase):
|
||||||
self.assertIn('State', container_info)
|
self.assertIn('State', container_info)
|
||||||
state = container_info['State']
|
state = container_info['State']
|
||||||
self.assertIn('ExitCode', state)
|
self.assertIn('ExitCode', state)
|
||||||
|
if EXEC_DRIVER_IS_NATIVE:
|
||||||
self.assertNotEqual(state['ExitCode'], 0)
|
self.assertNotEqual(state['ExitCode'], 0)
|
||||||
self.assertIn('Running', state)
|
self.assertIn('Running', state)
|
||||||
self.assertEqual(state['Running'], False)
|
self.assertEqual(state['Running'], False)
|
||||||
|
@ -978,6 +985,7 @@ class TestRestartingContainer(BaseTestCase):
|
||||||
self.client.remove_container(id, force=True)
|
self.client.remove_container(id, force=True)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE)
|
||||||
class TestExecuteCommand(BaseTestCase):
|
class TestExecuteCommand(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
container = self.client.create_container('busybox', 'cat',
|
container = self.client.create_container('busybox', 'cat',
|
||||||
|
@ -991,6 +999,7 @@ class TestExecuteCommand(BaseTestCase):
|
||||||
self.assertEqual(res, expected)
|
self.assertEqual(res, expected)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE)
|
||||||
class TestExecuteCommandString(BaseTestCase):
|
class TestExecuteCommandString(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
container = self.client.create_container('busybox', 'cat',
|
container = self.client.create_container('busybox', 'cat',
|
||||||
|
@ -1004,6 +1013,7 @@ class TestExecuteCommandString(BaseTestCase):
|
||||||
self.assertEqual(res, expected)
|
self.assertEqual(res, expected)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE)
|
||||||
class TestExecuteCommandStreaming(BaseTestCase):
|
class TestExecuteCommandStreaming(BaseTestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
container = self.client.create_container('busybox', 'cat',
|
container = self.client.create_container('busybox', 'cat',
|
||||||
|
@ -1458,5 +1468,7 @@ class TestRegressions(unittest.TestCase):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
c = docker.Client(base_url=DEFAULT_BASE_URL)
|
c = docker.Client(base_url=DEFAULT_BASE_URL)
|
||||||
c.pull('busybox')
|
c.pull('busybox')
|
||||||
|
exec_driver = c.info()['ExecutionDriver']
|
||||||
|
EXEC_DRIVER_IS_NATIVE = exec_driver.startswith('native')
|
||||||
c.close()
|
c.close()
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue