From b0cb31c18635f5bb277c51b656974ce6abef5205 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Thu, 21 May 2015 16:19:15 +0100 Subject: [PATCH] Use 'top' instead of 'sleep' as a dummy command Signed-off-by: Aanand Prasad --- .../fixtures/UpperCaseDir/docker-compose.yml | 4 ++-- .../dockerfile-with-volume/Dockerfile | 2 +- .../docker-compose.yml | 2 +- tests/fixtures/extends/docker-compose.yml | 4 ++-- .../links-composefile/docker-compose.yml | 6 ++--- .../docker-compose.yaml | 2 +- .../multiple-composefiles/compose2.yml | 2 +- .../multiple-composefiles/docker-compose.yml | 4 ++-- .../ports-composefile/docker-compose.yml | 2 +- .../simple-composefile/docker-compose.yml | 4 ++-- tests/integration/project_test.py | 22 +++++++++---------- tests/integration/service_test.py | 18 +++++++-------- tests/integration/state_test.py | 10 ++++----- tests/integration/testcases.py | 2 +- tests/unit/config_test.py | 4 ++-- tests/unit/container_test.py | 2 +- 16 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/fixtures/UpperCaseDir/docker-compose.yml b/tests/fixtures/UpperCaseDir/docker-compose.yml index 3538ab097..b25beaf4b 100644 --- a/tests/fixtures/UpperCaseDir/docker-compose.yml +++ b/tests/fixtures/UpperCaseDir/docker-compose.yml @@ -1,6 +1,6 @@ simple: image: busybox:latest - command: /bin/sleep 300 + command: top another: image: busybox:latest - command: /bin/sleep 300 + command: top diff --git a/tests/fixtures/dockerfile-with-volume/Dockerfile b/tests/fixtures/dockerfile-with-volume/Dockerfile index 2d6437cf4..6e5d0a55e 100644 --- a/tests/fixtures/dockerfile-with-volume/Dockerfile +++ b/tests/fixtures/dockerfile-with-volume/Dockerfile @@ -1,3 +1,3 @@ FROM busybox VOLUME /data -CMD sleep 3000 +CMD top diff --git a/tests/fixtures/environment-composefile/docker-compose.yml b/tests/fixtures/environment-composefile/docker-compose.yml index 924932273..9d99fee08 100644 --- a/tests/fixtures/environment-composefile/docker-compose.yml +++ b/tests/fixtures/environment-composefile/docker-compose.yml @@ -1,6 +1,6 @@ service: image: busybox:latest - command: sleep 5 + command: top environment: foo: bar diff --git a/tests/fixtures/extends/docker-compose.yml b/tests/fixtures/extends/docker-compose.yml index 0ae92d2a5..c51be49ec 100644 --- a/tests/fixtures/extends/docker-compose.yml +++ b/tests/fixtures/extends/docker-compose.yml @@ -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 diff --git a/tests/fixtures/links-composefile/docker-compose.yml b/tests/fixtures/links-composefile/docker-compose.yml index bc5391a99..930fd4c7a 100644 --- a/tests/fixtures/links-composefile/docker-compose.yml +++ b/tests/fixtures/links-composefile/docker-compose.yml @@ -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 diff --git a/tests/fixtures/longer-filename-composefile/docker-compose.yaml b/tests/fixtures/longer-filename-composefile/docker-compose.yaml index 315289402..b55a9e124 100644 --- a/tests/fixtures/longer-filename-composefile/docker-compose.yaml +++ b/tests/fixtures/longer-filename-composefile/docker-compose.yaml @@ -1,3 +1,3 @@ definedinyamlnotyml: image: busybox:latest - command: /bin/sleep 300 \ No newline at end of file + command: top \ No newline at end of file diff --git a/tests/fixtures/multiple-composefiles/compose2.yml b/tests/fixtures/multiple-composefiles/compose2.yml index 523becac2..568033804 100644 --- a/tests/fixtures/multiple-composefiles/compose2.yml +++ b/tests/fixtures/multiple-composefiles/compose2.yml @@ -1,3 +1,3 @@ yetanother: image: busybox:latest - command: /bin/sleep 300 + command: top diff --git a/tests/fixtures/multiple-composefiles/docker-compose.yml b/tests/fixtures/multiple-composefiles/docker-compose.yml index 3538ab097..b25beaf4b 100644 --- a/tests/fixtures/multiple-composefiles/docker-compose.yml +++ b/tests/fixtures/multiple-composefiles/docker-compose.yml @@ -1,6 +1,6 @@ simple: image: busybox:latest - command: /bin/sleep 300 + command: top another: image: busybox:latest - command: /bin/sleep 300 + command: top diff --git a/tests/fixtures/ports-composefile/docker-compose.yml b/tests/fixtures/ports-composefile/docker-compose.yml index 2474087d0..9496ee082 100644 --- a/tests/fixtures/ports-composefile/docker-compose.yml +++ b/tests/fixtures/ports-composefile/docker-compose.yml @@ -1,7 +1,7 @@ simple: image: busybox:latest - command: /bin/sleep 300 + command: top ports: - '3000' - '49152:3001' diff --git a/tests/fixtures/simple-composefile/docker-compose.yml b/tests/fixtures/simple-composefile/docker-compose.yml index 3538ab097..b25beaf4b 100644 --- a/tests/fixtures/simple-composefile/docker-compose.yml +++ b/tests/fixtures/simple-composefile/docker-compose.yml @@ -1,6 +1,6 @@ simple: image: busybox:latest - command: /bin/sleep 300 + command: top another: image: busybox:latest - command: /bin/sleep 300 + command: top diff --git a/tests/integration/project_test.py b/tests/integration/project_test.py index 6e315e84a..5e3a40e5b 100644 --- a/tests/integration/project_test.py +++ b/tests/integration/project_test.py @@ -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'], }, }), diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index b6cde37cc..8fd8212ce 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -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) diff --git a/tests/integration/state_test.py b/tests/integration/state_test.py index 3c0b2530f..7a7d2b58f 100644 --- a/tests/integration/state_test.py +++ b/tests/integration/state_test.py @@ -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) diff --git a/tests/integration/testcases.py b/tests/integration/testcases.py index 4a0f7248a..48fcf3ef2 100644 --- a/tests/integration/testcases.py +++ b/tests/integration/testcases.py @@ -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', diff --git a/tests/unit/config_test.py b/tests/unit/config_test.py index 0a48dfefe..ebd2af7d5 100644 --- a/tests/unit/config_test.py +++ b/tests/unit/config_test.py @@ -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", diff --git a/tests/unit/container_test.py b/tests/unit/container_test.py index 2313d4b8e..c537a8cf5 100644 --- a/tests/unit/container_test.py +++ b/tests/unit/container_test.py @@ -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,