Kaydet (Commit) ef0c373f authored tarafından Joffrey F's avatar Joffrey F

Pin busybox version to use in integration tests

Removed obsolete non-streaming build test
Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst b3ccdfbf
...@@ -47,6 +47,7 @@ warnings.simplefilter('error') ...@@ -47,6 +47,7 @@ warnings.simplefilter('error')
compare_version = docker.utils.compare_version compare_version = docker.utils.compare_version
EXEC_DRIVER = [] EXEC_DRIVER = []
BUSYBOX = 'busybox:buildroot-2014.02'
def exec_driver_is_native(): def exec_driver_is_native():
...@@ -70,7 +71,7 @@ def docker_client_kwargs(**kwargs): ...@@ -70,7 +71,7 @@ def docker_client_kwargs(**kwargs):
def setup_module(): def setup_module():
c = docker_client() c = docker_client()
c.pull('busybox') c.pull(BUSYBOX)
c.close() c.close()
...@@ -172,7 +173,7 @@ class TestListContainers(BaseTestCase): ...@@ -172,7 +173,7 @@ class TestListContainers(BaseTestCase):
def runTest(self): def runTest(self):
res0 = self.client.containers(all=True) res0 = self.client.containers(all=True)
size = len(res0) size = len(res0)
res1 = self.client.create_container('busybox:latest', 'true') res1 = self.client.create_container(BUSYBOX, 'true')
self.assertIn('Id', res1) self.assertIn('Id', res1)
self.client.start(res1['Id']) self.client.start(res1['Id'])
self.tmp_containers.append(res1['Id']) self.tmp_containers.append(res1['Id'])
...@@ -194,7 +195,7 @@ class TestListContainers(BaseTestCase): ...@@ -194,7 +195,7 @@ class TestListContainers(BaseTestCase):
class TestCreateContainer(BaseTestCase): class TestCreateContainer(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', 'true') res = self.client.create_container(BUSYBOX, 'true')
self.assertIn('Id', res) self.assertIn('Id', res)
self.tmp_containers.append(res['Id']) self.tmp_containers.append(res['Id'])
...@@ -216,7 +217,7 @@ class TestCreateContainerWithBinds(BaseTestCase): ...@@ -216,7 +217,7 @@ class TestCreateContainerWithBinds(BaseTestCase):
with open(shared_file, 'w'): with open(shared_file, 'w'):
container = self.client.create_container( container = self.client.create_container(
'busybox', BUSYBOX,
['ls', mount_dest], volumes={mount_dest: {}}, ['ls', mount_dest], volumes={mount_dest: {}},
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
binds=binds, network_mode='none' binds=binds, network_mode='none'
...@@ -260,7 +261,7 @@ class TestCreateContainerWithRoBinds(BaseTestCase): ...@@ -260,7 +261,7 @@ class TestCreateContainerWithRoBinds(BaseTestCase):
with open(shared_file, 'w'): with open(shared_file, 'w'):
container = self.client.create_container( container = self.client.create_container(
'busybox', BUSYBOX,
['ls', mount_dest], volumes={mount_dest: {}}, ['ls', mount_dest], volumes={mount_dest: {}},
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
binds=binds, network_mode='none' binds=binds, network_mode='none'
...@@ -291,7 +292,7 @@ class TestCreateContainerWithRoBinds(BaseTestCase): ...@@ -291,7 +292,7 @@ class TestCreateContainerWithRoBinds(BaseTestCase):
class CreateContainerWithGroupAddTest(BaseTestCase): class CreateContainerWithGroupAddTest(BaseTestCase):
def test_group_id_ints(self): def test_group_id_ints(self):
container = self.client.create_container( container = self.client.create_container(
'busybox', 'id -G', BUSYBOX, 'id -G',
host_config=self.client.create_host_config(group_add=[1000, 1001]) host_config=self.client.create_host_config(group_add=[1000, 1001])
) )
self.tmp_containers.append(container) self.tmp_containers.append(container)
...@@ -307,7 +308,7 @@ class CreateContainerWithGroupAddTest(BaseTestCase): ...@@ -307,7 +308,7 @@ class CreateContainerWithGroupAddTest(BaseTestCase):
def test_group_id_strings(self): def test_group_id_strings(self):
container = self.client.create_container( container = self.client.create_container(
'busybox', 'id -G', host_config=self.client.create_host_config( BUSYBOX, 'id -G', host_config=self.client.create_host_config(
group_add=['1000', '1001'] group_add=['1000', '1001']
) )
) )
...@@ -331,7 +332,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): ...@@ -331,7 +332,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase):
) )
container = self.client.create_container( container = self.client.create_container(
'busybox', ['true'], BUSYBOX, ['true'],
host_config=self.client.create_host_config(log_config=log_config) host_config=self.client.create_host_config(log_config=log_config)
) )
self.tmp_containers.append(container['Id']) self.tmp_containers.append(container['Id'])
...@@ -350,7 +351,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): ...@@ -350,7 +351,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase):
) )
container = self.client.create_container( container = self.client.create_container(
'busybox', ['true'], BUSYBOX, ['true'],
host_config=self.client.create_host_config(log_config=log_config) host_config=self.client.create_host_config(log_config=log_config)
) )
...@@ -371,7 +372,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): ...@@ -371,7 +372,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase):
) )
container = self.client.create_container( container = self.client.create_container(
'busybox', ['true'], BUSYBOX, ['true'],
host_config=self.client.create_host_config(log_config=log_config) host_config=self.client.create_host_config(log_config=log_config)
) )
self.tmp_containers.append(container['Id']) self.tmp_containers.append(container['Id'])
...@@ -390,7 +391,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): ...@@ -390,7 +391,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase):
) )
container = self.client.create_container( container = self.client.create_container(
'busybox', ['true'], BUSYBOX, ['true'],
host_config=self.client.create_host_config(log_config=log_config) host_config=self.client.create_host_config(log_config=log_config)
) )
self.tmp_containers.append(container['Id']) self.tmp_containers.append(container['Id'])
...@@ -409,7 +410,7 @@ class TestCreateContainerReadOnlyFs(BaseTestCase): ...@@ -409,7 +410,7 @@ class TestCreateContainerReadOnlyFs(BaseTestCase):
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
ctnr = self.client.create_container( ctnr = self.client.create_container(
'busybox', ['mkdir', '/shrine'], BUSYBOX, ['mkdir', '/shrine'],
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
read_only=True, network_mode='none' read_only=True, network_mode='none'
) )
...@@ -423,7 +424,7 @@ class TestCreateContainerReadOnlyFs(BaseTestCase): ...@@ -423,7 +424,7 @@ class TestCreateContainerReadOnlyFs(BaseTestCase):
class TestCreateContainerWithName(BaseTestCase): class TestCreateContainerWithName(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', 'true', name='foobar') res = self.client.create_container(BUSYBOX, 'true', name='foobar')
self.assertIn('Id', res) self.assertIn('Id', res)
self.tmp_containers.append(res['Id']) self.tmp_containers.append(res['Id'])
inspect = self.client.inspect_container(res['Id']) inspect = self.client.inspect_container(res['Id'])
...@@ -435,7 +436,7 @@ class TestRenameContainer(BaseTestCase): ...@@ -435,7 +436,7 @@ class TestRenameContainer(BaseTestCase):
def runTest(self): def runTest(self):
version = self.client.version()['Version'] version = self.client.version()['Version']
name = 'hong_meiling' name = 'hong_meiling'
res = self.client.create_container('busybox', 'true') res = self.client.create_container(BUSYBOX, 'true')
self.assertIn('Id', res) self.assertIn('Id', res)
self.tmp_containers.append(res['Id']) self.tmp_containers.append(res['Id'])
self.client.rename(res, name) self.client.rename(res, name)
...@@ -449,7 +450,7 @@ class TestRenameContainer(BaseTestCase): ...@@ -449,7 +450,7 @@ class TestRenameContainer(BaseTestCase):
class TestStartContainer(BaseTestCase): class TestStartContainer(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', 'true') res = self.client.create_container(BUSYBOX, 'true')
self.assertIn('Id', res) self.assertIn('Id', res)
self.tmp_containers.append(res['Id']) self.tmp_containers.append(res['Id'])
self.client.start(res['Id']) self.client.start(res['Id'])
...@@ -467,7 +468,7 @@ class TestStartContainer(BaseTestCase): ...@@ -467,7 +468,7 @@ class TestStartContainer(BaseTestCase):
class TestStartContainerWithDictInsteadOfId(BaseTestCase): class TestStartContainerWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', 'true') res = self.client.create_container(BUSYBOX, 'true')
self.assertIn('Id', res) self.assertIn('Id', res)
self.tmp_containers.append(res['Id']) self.tmp_containers.append(res['Id'])
self.client.start(res) self.client.start(res)
...@@ -486,7 +487,7 @@ class TestStartContainerWithDictInsteadOfId(BaseTestCase): ...@@ -486,7 +487,7 @@ class TestStartContainerWithDictInsteadOfId(BaseTestCase):
class TestCreateContainerPrivileged(BaseTestCase): class TestCreateContainerPrivileged(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container( res = self.client.create_container(
'busybox', 'true', host_config=self.client.create_host_config( BUSYBOX, 'true', host_config=self.client.create_host_config(
privileged=True, network_mode='none' privileged=True, network_mode='none'
) )
) )
...@@ -512,7 +513,7 @@ class TestCreateContainerPrivileged(BaseTestCase): ...@@ -512,7 +513,7 @@ class TestCreateContainerPrivileged(BaseTestCase):
class TestWait(BaseTestCase): class TestWait(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', ['sleep', '3']) res = self.client.create_container(BUSYBOX, ['sleep', '3'])
id = res['Id'] id = res['Id']
self.tmp_containers.append(id) self.tmp_containers.append(id)
self.client.start(id) self.client.start(id)
...@@ -527,7 +528,7 @@ class TestWait(BaseTestCase): ...@@ -527,7 +528,7 @@ class TestWait(BaseTestCase):
class TestWaitWithDictInsteadOfId(BaseTestCase): class TestWaitWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
res = self.client.create_container('busybox', ['sleep', '3']) res = self.client.create_container(BUSYBOX, ['sleep', '3'])
id = res['Id'] id = res['Id']
self.tmp_containers.append(id) self.tmp_containers.append(id)
self.client.start(res) self.client.start(res)
...@@ -544,7 +545,7 @@ class TestLogs(BaseTestCase): ...@@ -544,7 +545,7 @@ class TestLogs(BaseTestCase):
def runTest(self): def runTest(self):
snippet = 'Flowering Nights (Sakuya Iyazoi)' snippet = 'Flowering Nights (Sakuya Iyazoi)'
container = self.client.create_container( container = self.client.create_container(
'busybox', 'echo {0}'.format(snippet) BUSYBOX, 'echo {0}'.format(snippet)
) )
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -560,7 +561,7 @@ class TestLogsWithTailOption(BaseTestCase): ...@@ -560,7 +561,7 @@ class TestLogsWithTailOption(BaseTestCase):
snippet = '''Line1 snippet = '''Line1
Line2''' Line2'''
container = self.client.create_container( container = self.client.create_container(
'busybox', 'echo "{0}"'.format(snippet) BUSYBOX, 'echo "{0}"'.format(snippet)
) )
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -575,7 +576,7 @@ Line2''' ...@@ -575,7 +576,7 @@ Line2'''
# def runTest(self): # def runTest(self):
# snippet = 'Flowering Nights (Sakuya Iyazoi)' # snippet = 'Flowering Nights (Sakuya Iyazoi)'
# container = self.client.create_container( # container = self.client.create_container(
# 'busybox', 'echo {0}'.format(snippet) # BUSYBOX, 'echo {0}'.format(snippet)
# ) # )
# id = container['Id'] # id = container['Id']
# self.client.start(id) # self.client.start(id)
...@@ -594,7 +595,7 @@ class TestLogsWithDictInsteadOfId(BaseTestCase): ...@@ -594,7 +595,7 @@ class TestLogsWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
snippet = 'Flowering Nights (Sakuya Iyazoi)' snippet = 'Flowering Nights (Sakuya Iyazoi)'
container = self.client.create_container( container = self.client.create_container(
'busybox', 'echo {0}'.format(snippet) BUSYBOX, 'echo {0}'.format(snippet)
) )
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -607,7 +608,7 @@ class TestLogsWithDictInsteadOfId(BaseTestCase): ...@@ -607,7 +608,7 @@ class TestLogsWithDictInsteadOfId(BaseTestCase):
class TestDiff(BaseTestCase): class TestDiff(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['touch', '/test']) container = self.client.create_container(BUSYBOX, ['touch', '/test'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -622,7 +623,7 @@ class TestDiff(BaseTestCase): ...@@ -622,7 +623,7 @@ class TestDiff(BaseTestCase):
class TestDiffWithDictInsteadOfId(BaseTestCase): class TestDiffWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['touch', '/test']) container = self.client.create_container(BUSYBOX, ['touch', '/test'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -637,7 +638,7 @@ class TestDiffWithDictInsteadOfId(BaseTestCase): ...@@ -637,7 +638,7 @@ class TestDiffWithDictInsteadOfId(BaseTestCase):
class TestStop(BaseTestCase): class TestStop(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -654,7 +655,7 @@ class TestStop(BaseTestCase): ...@@ -654,7 +655,7 @@ class TestStop(BaseTestCase):
class TestStopWithDictInsteadOfId(BaseTestCase): class TestStopWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
self.assertIn('Id', container) self.assertIn('Id', container)
id = container['Id'] id = container['Id']
self.client.start(container) self.client.start(container)
...@@ -672,7 +673,7 @@ class TestStopWithDictInsteadOfId(BaseTestCase): ...@@ -672,7 +673,7 @@ class TestStopWithDictInsteadOfId(BaseTestCase):
class TestKill(BaseTestCase): class TestKill(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -689,7 +690,7 @@ class TestKill(BaseTestCase): ...@@ -689,7 +690,7 @@ class TestKill(BaseTestCase):
class TestKillWithDictInsteadOfId(BaseTestCase): class TestKillWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -706,7 +707,7 @@ class TestKillWithDictInsteadOfId(BaseTestCase): ...@@ -706,7 +707,7 @@ class TestKillWithDictInsteadOfId(BaseTestCase):
class TestKillWithSignal(BaseTestCase): class TestKillWithSignal(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '60']) container = self.client.create_container(BUSYBOX, ['sleep', '60'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -731,7 +732,7 @@ class TestPort(BaseTestCase): ...@@ -731,7 +732,7 @@ class TestPort(BaseTestCase):
} }
container = self.client.create_container( container = self.client.create_container(
'busybox', ['sleep', '60'], ports=list(port_bindings.keys()), BUSYBOX, ['sleep', '60'], ports=list(port_bindings.keys()),
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
port_bindings=port_bindings, network_mode='bridge' port_bindings=port_bindings, network_mode='bridge'
) )
...@@ -757,7 +758,7 @@ class TestMacAddress(BaseTestCase): ...@@ -757,7 +758,7 @@ class TestMacAddress(BaseTestCase):
def runTest(self): def runTest(self):
mac_address_expected = "02:42:ac:11:00:0a" mac_address_expected = "02:42:ac:11:00:0a"
container = self.client.create_container( container = self.client.create_container(
'busybox', ['sleep', '60'], mac_address=mac_address_expected) BUSYBOX, ['sleep', '60'], mac_address=mac_address_expected)
id = container['Id'] id = container['Id']
...@@ -771,7 +772,7 @@ class TestMacAddress(BaseTestCase): ...@@ -771,7 +772,7 @@ class TestMacAddress(BaseTestCase):
class TestRestart(BaseTestCase): class TestRestart(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -792,7 +793,7 @@ class TestRestart(BaseTestCase): ...@@ -792,7 +793,7 @@ class TestRestart(BaseTestCase):
class TestRestartWithDictInsteadOfId(BaseTestCase): class TestRestartWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
self.assertIn('Id', container) self.assertIn('Id', container)
id = container['Id'] id = container['Id']
self.client.start(container) self.client.start(container)
...@@ -814,7 +815,7 @@ class TestRestartWithDictInsteadOfId(BaseTestCase): ...@@ -814,7 +815,7 @@ class TestRestartWithDictInsteadOfId(BaseTestCase):
class TestRemoveContainer(BaseTestCase): class TestRemoveContainer(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['true']) container = self.client.create_container(BUSYBOX, ['true'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.client.wait(id) self.client.wait(id)
...@@ -826,7 +827,7 @@ class TestRemoveContainer(BaseTestCase): ...@@ -826,7 +827,7 @@ class TestRemoveContainer(BaseTestCase):
class TestRemoveContainerWithDictInsteadOfId(BaseTestCase): class TestRemoveContainerWithDictInsteadOfId(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['true']) container = self.client.create_container(BUSYBOX, ['true'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.client.wait(id) self.client.wait(id)
...@@ -841,25 +842,25 @@ class TestCreateContainerWithVolumesFrom(BaseTestCase): ...@@ -841,25 +842,25 @@ class TestCreateContainerWithVolumesFrom(BaseTestCase):
vol_names = ['foobar_vol0', 'foobar_vol1'] vol_names = ['foobar_vol0', 'foobar_vol1']
res0 = self.client.create_container( res0 = self.client.create_container(
'busybox', 'true', name=vol_names[0] BUSYBOX, 'true', name=vol_names[0]
) )
container1_id = res0['Id'] container1_id = res0['Id']
self.tmp_containers.append(container1_id) self.tmp_containers.append(container1_id)
self.client.start(container1_id) self.client.start(container1_id)
res1 = self.client.create_container( res1 = self.client.create_container(
'busybox', 'true', name=vol_names[1] BUSYBOX, 'true', name=vol_names[1]
) )
container2_id = res1['Id'] container2_id = res1['Id']
self.tmp_containers.append(container2_id) self.tmp_containers.append(container2_id)
self.client.start(container2_id) self.client.start(container2_id)
with self.assertRaises(docker.errors.DockerException): with self.assertRaises(docker.errors.DockerException):
self.client.create_container( self.client.create_container(
'busybox', 'cat', detach=True, stdin_open=True, BUSYBOX, 'cat', detach=True, stdin_open=True,
volumes_from=vol_names volumes_from=vol_names
) )
res2 = self.client.create_container( res2 = self.client.create_container(
'busybox', 'cat', detach=True, stdin_open=True, BUSYBOX, 'cat', detach=True, stdin_open=True,
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
volumes_from=vol_names, network_mode='none' volumes_from=vol_names, network_mode='none'
) )
...@@ -875,7 +876,7 @@ class TestCreateContainerWithVolumesFrom(BaseTestCase): ...@@ -875,7 +876,7 @@ class TestCreateContainerWithVolumesFrom(BaseTestCase):
class TestCreateContainerWithLinks(BaseTestCase): class TestCreateContainerWithLinks(BaseTestCase):
def runTest(self): def runTest(self):
res0 = self.client.create_container( res0 = self.client.create_container(
'busybox', 'cat', BUSYBOX, 'cat',
detach=True, stdin_open=True, detach=True, stdin_open=True,
environment={'FOO': '1'}) environment={'FOO': '1'})
...@@ -885,7 +886,7 @@ class TestCreateContainerWithLinks(BaseTestCase): ...@@ -885,7 +886,7 @@ class TestCreateContainerWithLinks(BaseTestCase):
self.client.start(container1_id) self.client.start(container1_id)
res1 = self.client.create_container( res1 = self.client.create_container(
'busybox', 'cat', BUSYBOX, 'cat',
detach=True, stdin_open=True, detach=True, stdin_open=True,
environment={'FOO': '1'}) environment={'FOO': '1'})
...@@ -904,7 +905,7 @@ class TestCreateContainerWithLinks(BaseTestCase): ...@@ -904,7 +905,7 @@ class TestCreateContainerWithLinks(BaseTestCase):
link_env_prefix2 = link_alias2.upper() link_env_prefix2 = link_alias2.upper()
res2 = self.client.create_container( res2 = self.client.create_container(
'busybox', 'env', host_config=self.client.create_host_config( BUSYBOX, 'env', host_config=self.client.create_host_config(
links={link_path1: link_alias1, link_path2: link_alias2}, links={link_path1: link_alias1, link_path2: link_alias2},
network_mode='none' network_mode='none'
) )
...@@ -926,7 +927,7 @@ class TestCreateContainerWithLinks(BaseTestCase): ...@@ -926,7 +927,7 @@ class TestCreateContainerWithLinks(BaseTestCase):
class TestRestartingContainer(BaseTestCase): class TestRestartingContainer(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container( container = self.client.create_container(
'busybox', ['sleep', '2'], BUSYBOX, ['sleep', '2'],
host_config=self.client.create_host_config( host_config=self.client.create_host_config(
restart_policy={"Name": "always", "MaximumRetryCount": 0}, restart_policy={"Name": "always", "MaximumRetryCount": 0},
network_mode='none' network_mode='none'
...@@ -949,7 +950,7 @@ class TestExecuteCommand(BaseTestCase): ...@@ -949,7 +950,7 @@ class TestExecuteCommand(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -967,7 +968,7 @@ class TestExecuteCommandString(BaseTestCase): ...@@ -967,7 +968,7 @@ class TestExecuteCommandString(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -985,7 +986,7 @@ class TestExecuteCommandStringAsUser(BaseTestCase): ...@@ -985,7 +986,7 @@ class TestExecuteCommandStringAsUser(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -1003,7 +1004,7 @@ class TestExecuteCommandStringAsRoot(BaseTestCase): ...@@ -1003,7 +1004,7 @@ class TestExecuteCommandStringAsRoot(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -1021,7 +1022,7 @@ class TestExecuteCommandStreaming(BaseTestCase): ...@@ -1021,7 +1022,7 @@ class TestExecuteCommandStreaming(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -1041,7 +1042,7 @@ class TestExecInspect(BaseTestCase): ...@@ -1041,7 +1042,7 @@ class TestExecInspect(BaseTestCase):
if not exec_driver_is_native(): if not exec_driver_is_native():
pytest.skip('Exec driver not native') pytest.skip('Exec driver not native')
container = self.client.create_container('busybox', 'cat', container = self.client.create_container(BUSYBOX, 'cat',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -1057,7 +1058,7 @@ class TestExecInspect(BaseTestCase): ...@@ -1057,7 +1058,7 @@ class TestExecInspect(BaseTestCase):
class TestRunContainerStreaming(BaseTestCase): class TestRunContainerStreaming(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', '/bin/sh', container = self.client.create_container(BUSYBOX, '/bin/sh',
detach=True, stdin_open=True) detach=True, stdin_open=True)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
...@@ -1068,7 +1069,7 @@ class TestRunContainerStreaming(BaseTestCase): ...@@ -1068,7 +1069,7 @@ class TestRunContainerStreaming(BaseTestCase):
class TestPauseUnpauseContainer(BaseTestCase): class TestPauseUnpauseContainer(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
id = container['Id'] id = container['Id']
self.tmp_containers.append(id) self.tmp_containers.append(id)
self.client.start(container) self.client.start(container)
...@@ -1098,7 +1099,7 @@ class TestPauseUnpauseContainer(BaseTestCase): ...@@ -1098,7 +1099,7 @@ class TestPauseUnpauseContainer(BaseTestCase):
class TestCreateContainerWithHostPidMode(BaseTestCase): class TestCreateContainerWithHostPidMode(BaseTestCase):
def runTest(self): def runTest(self):
ctnr = self.client.create_container( ctnr = self.client.create_container(
'busybox', 'true', host_config=self.client.create_host_config( BUSYBOX, 'true', host_config=self.client.create_host_config(
pid_mode='host', network_mode='none' pid_mode='host', network_mode='none'
) )
) )
...@@ -1121,7 +1122,7 @@ class TestRemoveLink(BaseTestCase): ...@@ -1121,7 +1122,7 @@ class TestRemoveLink(BaseTestCase):
def runTest(self): def runTest(self):
# Create containers # Create containers
container1 = self.client.create_container( container1 = self.client.create_container(
'busybox', 'cat', detach=True, stdin_open=True BUSYBOX, 'cat', detach=True, stdin_open=True
) )
container1_id = container1['Id'] container1_id = container1['Id']
self.tmp_containers.append(container1_id) self.tmp_containers.append(container1_id)
...@@ -1133,7 +1134,7 @@ class TestRemoveLink(BaseTestCase): ...@@ -1133,7 +1134,7 @@ class TestRemoveLink(BaseTestCase):
link_alias = 'mylink' link_alias = 'mylink'
container2 = self.client.create_container( container2 = self.client.create_container(
'busybox', 'cat', host_config=self.client.create_host_config( BUSYBOX, 'cat', host_config=self.client.create_host_config(
links={link_path: link_alias}, network_mode='none' links={link_path: link_alias}, network_mode='none'
) )
) )
...@@ -1200,7 +1201,7 @@ class TestPullStream(BaseTestCase): ...@@ -1200,7 +1201,7 @@ class TestPullStream(BaseTestCase):
class TestCommit(BaseTestCase): class TestCommit(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['touch', '/test']) container = self.client.create_container(BUSYBOX, ['touch', '/test'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -1213,15 +1214,15 @@ class TestCommit(BaseTestCase): ...@@ -1213,15 +1214,15 @@ class TestCommit(BaseTestCase):
self.assertTrue(img['Container'].startswith(id)) self.assertTrue(img['Container'].startswith(id))
self.assertIn('ContainerConfig', img) self.assertIn('ContainerConfig', img)
self.assertIn('Image', img['ContainerConfig']) self.assertIn('Image', img['ContainerConfig'])
self.assertEqual('busybox', img['ContainerConfig']['Image']) self.assertEqual(BUSYBOX, img['ContainerConfig']['Image'])
busybox_id = self.client.inspect_image('busybox')['Id'] busybox_id = self.client.inspect_image(BUSYBOX)['Id']
self.assertIn('Parent', img) self.assertIn('Parent', img)
self.assertEqual(img['Parent'], busybox_id) self.assertEqual(img['Parent'], busybox_id)
class TestRemoveImage(BaseTestCase): class TestRemoveImage(BaseTestCase):
def runTest(self): def runTest(self):
container = self.client.create_container('busybox', ['touch', '/test']) container = self.client.create_container(BUSYBOX, ['touch', '/test'])
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -1443,37 +1444,6 @@ class TestVolumes(BaseTestCase): ...@@ -1443,37 +1444,6 @@ class TestVolumes(BaseTestCase):
# BUILDER TESTS # # BUILDER TESTS #
################# #################
class TestBuild(BaseTestCase):
def runTest(self):
if compare_version(self.client._version, '1.8') < 0:
return
script = io.BytesIO('\n'.join([
'FROM busybox',
'MAINTAINER docker-py',
'RUN mkdir -p /tmp/test',
'EXPOSE 8080',
'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
' /tmp/silence.tar.gz'
]).encode('ascii'))
img, logs = self.client.build(fileobj=script)
self.assertNotEqual(img, None)
self.assertNotEqual(img, '')
self.assertNotEqual(logs, '')
container1 = self.client.create_container(img, 'test -d /tmp/test')
id1 = container1['Id']
self.client.start(id1)
self.tmp_containers.append(id1)
exitcode1 = self.client.wait(id1)
self.assertEqual(exitcode1, 0)
container2 = self.client.create_container(img, 'test -d /tmp/test')
id2 = container2['Id']
self.client.start(id2)
self.tmp_containers.append(id2)
exitcode2 = self.client.wait(id2)
self.assertEqual(exitcode2, 0)
self.tmp_imgs.append(img)
class TestBuildStream(BaseTestCase): class TestBuildStream(BaseTestCase):
def runTest(self): def runTest(self):
script = io.BytesIO('\n'.join([ script = io.BytesIO('\n'.join([
...@@ -1515,11 +1485,9 @@ class TestBuildFromStringIO(BaseTestCase): ...@@ -1515,11 +1485,9 @@ class TestBuildFromStringIO(BaseTestCase):
self.assertNotEqual(logs, '') self.assertNotEqual(logs, '')
@requires_api_version('1.8')
class TestBuildWithDockerignore(Cleanup, BaseTestCase): class TestBuildWithDockerignore(Cleanup, BaseTestCase):
def runTest(self): def runTest(self):
if compare_version(self.client._version, '1.8') >= 0:
return
base_dir = tempfile.mkdtemp() base_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, base_dir) self.addCleanup(shutil.rmtree, base_dir)
...@@ -1586,7 +1554,7 @@ class TestRunShlex(BaseTestCase): ...@@ -1586,7 +1554,7 @@ class TestRunShlex(BaseTestCase):
'true && echo "Night of Nights"' 'true && echo "Night of Nights"'
] ]
for cmd in commands: for cmd in commands:
container = self.client.create_container('busybox', cmd) container = self.client.create_container(BUSYBOX, cmd)
id = container['Id'] id = container['Id']
self.client.start(id) self.client.start(id)
self.tmp_containers.append(id) self.tmp_containers.append(id)
...@@ -1711,7 +1679,7 @@ class TestRegressions(BaseTestCase): ...@@ -1711,7 +1679,7 @@ class TestRegressions(BaseTestCase):
def test_542(self): def test_542(self):
self.client.start( self.client.start(
self.client.create_container('busybox', ['true']) self.client.create_container(BUSYBOX, ['true'])
) )
result = self.client.containers(all=True, trunc=True) result = self.client.containers(all=True, trunc=True)
self.assertEqual(len(result[0]['Id']), 12) self.assertEqual(len(result[0]['Id']), 12)
...@@ -1722,12 +1690,12 @@ class TestRegressions(BaseTestCase): ...@@ -1722,12 +1690,12 @@ class TestRegressions(BaseTestCase):
def test_649(self): def test_649(self):
self.client.timeout = None self.client.timeout = None
ctnr = self.client.create_container('busybox', ['sleep', '2']) ctnr = self.client.create_container(BUSYBOX, ['sleep', '2'])
self.client.start(ctnr) self.client.start(ctnr)
self.client.stop(ctnr) self.client.stop(ctnr)
def test_715(self): def test_715(self):
ctnr = self.client.create_container('busybox', ['id', '-u'], user=1000) ctnr = self.client.create_container(BUSYBOX, ['id', '-u'], user=1000)
self.client.start(ctnr) self.client.start(ctnr)
self.client.wait(ctnr) self.client.wait(ctnr)
logs = self.client.logs(ctnr) logs = self.client.logs(ctnr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment