Use 'top' instead of 'sleep' as a dummy command

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2015-05-21 16:19:15 +01:00
parent b183a66db1
commit b0cb31c186
16 changed files with 45 additions and 45 deletions

View File

@ -1,6 +1,6 @@
simple:
image: busybox:latest
command: /bin/sleep 300
command: top
another:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -1,3 +1,3 @@
FROM busybox
VOLUME /data
CMD sleep 3000
CMD top

View File

@ -1,6 +1,6 @@
service:
image: busybox:latest
command: sleep 5
command: top
environment:
foo: bar

View File

@ -2,7 +2,7 @@ myweb:
extends:
file: common.yml
service: web
command: sleep 300
command: top
links:
- "mydb:db"
environment:
@ -13,4 +13,4 @@ myweb:
BAZ: "2"
mydb:
image: busybox
command: sleep 300
command: top

View File

@ -1,11 +1,11 @@
db:
image: busybox:latest
command: /bin/sleep 300
command: top
web:
image: busybox:latest
command: /bin/sleep 300
command: top
links:
- db:db
console:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -1,3 +1,3 @@
definedinyamlnotyml:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -1,3 +1,3 @@
yetanother:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -1,6 +1,6 @@
simple:
image: busybox:latest
command: /bin/sleep 300
command: top
another:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -1,7 +1,7 @@
simple:
image: busybox:latest
command: /bin/sleep 300
command: top
ports:
- '3000'
- '49152:3001'

View File

@ -1,6 +1,6 @@
simple:
image: busybox:latest
command: /bin/sleep 300
command: top
another:
image: busybox:latest
command: /bin/sleep 300
command: top

View File

@ -78,12 +78,12 @@ class ProjectTest(DockerClientTestCase):
service_dicts=config.from_dictionary({
'net': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"]
'command': ["top"]
},
'web': {
'image': 'busybox:latest',
'net': 'container:net',
'command': ["/bin/sleep", "300"]
'command': ["top"]
},
}),
client=self.client,
@ -103,7 +103,7 @@ class ProjectTest(DockerClientTestCase):
self.client,
image='busybox:latest',
name='composetest_net_container',
command='/bin/sleep 300'
command='top'
)
net_container.start()
@ -288,20 +288,20 @@ class ProjectTest(DockerClientTestCase):
service_dicts=config.from_dictionary({
'console': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
},
'data': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"]
'command': ["top"]
},
'db': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
'volumes_from': ['data'],
},
'web': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
'links': ['db'],
},
}),
@ -326,20 +326,20 @@ class ProjectTest(DockerClientTestCase):
service_dicts=config.from_dictionary({
'console': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
},
'data': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"]
'command': ["top"]
},
'db': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
'volumes_from': ['data'],
},
'web': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'command': ["top"],
'links': ['db'],
},
}),

View File

@ -236,7 +236,7 @@ class ServiceTest(DockerClientTestCase):
def test_create_container_with_volumes_from(self):
volume_service = self.create_service('data')
volume_container_1 = volume_service.create_container()
volume_container_2 = Container.create(self.client, image='busybox:latest', command=["/bin/sleep", "300"])
volume_container_2 = Container.create(self.client, image='busybox:latest', command=["top"])
host_service = self.create_service('host', volumes_from=[volume_service, volume_container_2])
host_container = host_service.create_container()
host_service.start_container(host_container)
@ -250,12 +250,12 @@ class ServiceTest(DockerClientTestCase):
'db',
environment={'FOO': '1'},
volumes=['/etc'],
entrypoint=['sleep'],
command=['300']
entrypoint=['top'],
command=['-d', '1']
)
old_container = service.create_container()
self.assertEqual(old_container.get('Config.Entrypoint'), ['sleep'])
self.assertEqual(old_container.get('Config.Cmd'), ['300'])
self.assertEqual(old_container.get('Config.Entrypoint'), ['top'])
self.assertEqual(old_container.get('Config.Cmd'), ['-d', '1'])
self.assertIn('FOO=1', old_container.get('Config.Env'))
self.assertEqual(old_container.name, 'composetest_db_1')
service.start_container(old_container)
@ -267,8 +267,8 @@ class ServiceTest(DockerClientTestCase):
service.options['environment']['FOO'] = '2'
new_container = service.converge()[0]
self.assertEqual(new_container.get('Config.Entrypoint'), ['sleep'])
self.assertEqual(new_container.get('Config.Cmd'), ['300'])
self.assertEqual(new_container.get('Config.Entrypoint'), ['top'])
self.assertEqual(new_container.get('Config.Cmd'), ['-d', '1'])
self.assertIn('FOO=2', new_container.get('Config.Env'))
self.assertEqual(new_container.name, 'composetest_db_1')
self.assertEqual(new_container.get('Volumes')['/etc'], volume_path)
@ -287,8 +287,8 @@ class ServiceTest(DockerClientTestCase):
'db',
environment={'FOO': '1'},
volumes=['/var/db'],
entrypoint=['sleep'],
command=['300']
entrypoint=['top'],
command=['-d', '1']
)
service.create_container()
self.assertEqual(len(service.containers(stopped=True)), 1)

View File

@ -167,7 +167,7 @@ class ServiceStateTest(DockerClientTestCase):
self.assertEqual(('noop', [container]), web.convergence_plan(smart_recreate=True))
def test_trigger_start(self):
options = dict(command=["/bin/sleep", "300"])
options = dict(command=["top"])
web = self.create_service('web', **options)
web.scale(2)
@ -185,10 +185,10 @@ class ServiceStateTest(DockerClientTestCase):
)
def test_trigger_recreate_with_config_change(self):
web = self.create_service('web', command=["/bin/sleep", "300"])
web = self.create_service('web', command=["top"])
container = web.create_container()
web = self.create_service('web', command=["/bin/sleep", "400"])
web = self.create_service('web', command=["top", "-d", "1"])
self.assertEqual(('recreate', [container]), web.convergence_plan(smart_recreate=True))
def test_trigger_recreate_with_image_change(self):
@ -254,10 +254,10 @@ class ConfigHashTest(DockerClientTestCase):
self.assertIn('foo', container.labels)
def test_config_hash_sticks_around(self):
web = self.create_service('web', command=["/bin/sleep", "300"])
web = self.create_service('web', command=["top"])
container = web.converge()[0]
self.assertIn(LABEL_CONFIG_HASH, container.labels)
web = self.create_service('web', command=["/bin/sleep", "400"])
web = self.create_service('web', command=["top", "-d", "1"])
container = web.converge()[0]
self.assertIn(LABEL_CONFIG_HASH, container.labels)

View File

@ -27,7 +27,7 @@ class DockerClientTestCase(unittest.TestCase):
kwargs['image'] = 'busybox:latest'
if 'command' not in kwargs:
kwargs['command'] = ["/bin/sleep", "300"]
kwargs['command'] = ["top"]
return Service(
project='composetest',

View File

@ -348,12 +348,12 @@ class ExtendsTest(unittest.TestCase):
{
'name': 'mydb',
'image': 'busybox',
'command': 'sleep 300',
'command': 'top',
},
{
'name': 'myweb',
'image': 'busybox',
'command': 'sleep 300',
'command': 'top',
'links': ['mydb:db'],
'environment': {
"FOO": "1",

View File

@ -14,7 +14,7 @@ class ContainerTest(unittest.TestCase):
self.container_dict = {
"Id": "abc",
"Image": "busybox:latest",
"Command": "sleep 300",
"Command": "top",
"Created": 1387384730,
"Status": "Up 8 seconds",
"Ports": None,