浏览代码

Update acceptance test for image matching

Signed-off-by: Joffrey F <[email protected]>
Joffrey F 7 年之前
父节点
当前提交
834acca497

+ 4 - 7
tests/acceptance/cli_test.py

@@ -2773,13 +2773,10 @@ class CLITestCase(DockerClientTestCase):
 
     def test_images_use_service_tag(self):
         pull_busybox(self.client)
-        self.base_dir = 'tests/fixtures/images-service-tag/dev'
-        self.dispatch(['build'])
-        self.base_dir = 'tests/fixtures/images-service-tag/prod'
-        self.dispatch(['build'])
         self.base_dir = 'tests/fixtures/images-service-tag'
-        self.dispatch(['up', '-d'])
+        self.dispatch(['up', '-d', '--build'])
         result = self.dispatch(['images'])
-        self.dispatch(['down'])
 
-        assert 'dev' in result.stdout
+        assert re.search(r'foo1.+test[ \t]+dev', result.stdout) is not None
+        assert re.search(r'foo2.+test[ \t]+prod', result.stdout) is not None
+        assert re.search(r'foo3.+_foo3[ \t]+latest', result.stdout) is not None

+ 2 - 0
tests/fixtures/images-service-tag/Dockerfile

@@ -0,0 +1,2 @@
+FROM busybox:latest
+RUN touch /foo

+ 0 - 2
tests/fixtures/images-service-tag/dev/Dockerfile

@@ -1,2 +0,0 @@
-FROM busybox:latest
-RUN touch /same-image

+ 0 - 6
tests/fixtures/images-service-tag/dev/docker-compose.yml

@@ -1,6 +0,0 @@
-version: "2.2"
-
-services:
-  test:
-    image: busybox:dev
-    build: .

+ 9 - 4
tests/fixtures/images-service-tag/docker-compose.yml

@@ -1,5 +1,10 @@
-version: "2.2"
-
+version: "2.4"
 services:
-  test:
-    image: busybox:dev
+  foo1:
+    build: .
+    image: test:dev
+  foo2:
+    build: .
+    image: test:prod
+  foo3:
+    build: .

+ 0 - 2
tests/fixtures/images-service-tag/prod/Dockerfile

@@ -1,2 +0,0 @@
-FROM busybox:latest
-RUN touch /same-image

+ 0 - 6
tests/fixtures/images-service-tag/prod/docker-compose.yml

@@ -1,6 +0,0 @@
-version: "2.2"
-
-services:
-  test:
-    image: busybox:dev
-    build: .