From 1b668973a2f3c28370a77d8af51cd2dc082dda0a Mon Sep 17 00:00:00 2001 From: Boris HUISGEN Date: Thu, 5 Jul 2018 23:33:13 +0200 Subject: [PATCH] Add acceptance test Signed-off-by: Boris HUISGEN --- tests/acceptance/cli_test.py | 13 +++++++++++++ tests/fixtures/images-service-tag/dev/Dockerfile | 2 ++ .../images-service-tag/dev/docker-compose.yml | 6 ++++++ .../fixtures/images-service-tag/docker-compose.yml | 5 +++++ tests/fixtures/images-service-tag/prod/Dockerfile | 2 ++ .../images-service-tag/prod/docker-compose.yml | 6 ++++++ 6 files changed, 34 insertions(+) create mode 100644 tests/fixtures/images-service-tag/dev/Dockerfile create mode 100644 tests/fixtures/images-service-tag/dev/docker-compose.yml create mode 100644 tests/fixtures/images-service-tag/docker-compose.yml create mode 100644 tests/fixtures/images-service-tag/prod/Dockerfile create mode 100644 tests/fixtures/images-service-tag/prod/docker-compose.yml diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 015180bc7..ef7e88990 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -2770,3 +2770,16 @@ class CLITestCase(DockerClientTestCase): with pytest.raises(DuplicateOverrideFileFound): get_project(self.base_dir, []) self.base_dir = None + + 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']) + result = self.dispatch(['images']) + self.dispatch(['down']) + + assert 'dev' in result.stdout diff --git a/tests/fixtures/images-service-tag/dev/Dockerfile b/tests/fixtures/images-service-tag/dev/Dockerfile new file mode 100644 index 000000000..570e11ae3 --- /dev/null +++ b/tests/fixtures/images-service-tag/dev/Dockerfile @@ -0,0 +1,2 @@ +FROM busybox:latest +RUN touch /same-image diff --git a/tests/fixtures/images-service-tag/dev/docker-compose.yml b/tests/fixtures/images-service-tag/dev/docker-compose.yml new file mode 100644 index 000000000..cb01f6f35 --- /dev/null +++ b/tests/fixtures/images-service-tag/dev/docker-compose.yml @@ -0,0 +1,6 @@ +version: "2.2" + +services: + test: + image: busybox:dev + build: . diff --git a/tests/fixtures/images-service-tag/docker-compose.yml b/tests/fixtures/images-service-tag/docker-compose.yml new file mode 100644 index 000000000..824b9416b --- /dev/null +++ b/tests/fixtures/images-service-tag/docker-compose.yml @@ -0,0 +1,5 @@ +version: "2.2" + +services: + test: + image: busybox:dev diff --git a/tests/fixtures/images-service-tag/prod/Dockerfile b/tests/fixtures/images-service-tag/prod/Dockerfile new file mode 100644 index 000000000..570e11ae3 --- /dev/null +++ b/tests/fixtures/images-service-tag/prod/Dockerfile @@ -0,0 +1,2 @@ +FROM busybox:latest +RUN touch /same-image diff --git a/tests/fixtures/images-service-tag/prod/docker-compose.yml b/tests/fixtures/images-service-tag/prod/docker-compose.yml new file mode 100644 index 000000000..cb01f6f35 --- /dev/null +++ b/tests/fixtures/images-service-tag/prod/docker-compose.yml @@ -0,0 +1,6 @@ +version: "2.2" + +services: + test: + image: busybox:dev + build: .