瀏覽代碼

Prevent flaky test by changing container names.

Signed-off-by: Daniel Nephin <[email protected]>
Daniel Nephin 10 年之前
父節點
當前提交
235fe21fd0
共有 3 個文件被更改,包括 4 次插入2 次删除
  1. 1 1
      tests/integration/service_test.py
  2. 0 1
      tests/integration/state_test.py
  3. 3 0
      tests/integration/testcases.py

+ 1 - 1
tests/integration/service_test.py

@@ -695,7 +695,7 @@ class ServiceTest(DockerClientTestCase):
         Test that calling scale on a service that has a custom container name
         results in warning output.
         """
-        service = self.create_service('web', container_name='custom-container')
+        service = self.create_service('app', container_name='custom-container')
         self.assertEqual(service.custom_container_name(), 'custom-container')
 
         service.scale(3)

+ 0 - 1
tests/integration/state_test.py

@@ -199,7 +199,6 @@ class ServiceStateTest(DockerClientTestCase):
 
         self.assertEqual([c.is_running for c in containers], [False, True])
 
-        web = self.create_service('web', **options)
         self.assertEqual(
             ('start', containers[0:1]),
             web.convergence_plan(),

+ 3 - 0
tests/integration/testcases.py

@@ -33,6 +33,9 @@ class DockerClientTestCase(unittest.TestCase):
 
         options = ServiceLoader(working_dir='.').make_service_dict(name, kwargs)
 
+        labels = options.setdefault('labels', {})
+        labels['com.docker.compose.test-name'] = self.id()
+
         return Service(
             project='composetest',
             client=self.client,