diff options
author | Joffrey F <joffrey@docker.com> | 2018-01-26 15:59:46 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-01-26 15:59:46 -0800 |
commit | 631cc3c1215441edb075a999a77061c1275c5e5a (patch) | |
tree | 7d605cd7451cf94f0698b8a318721c8e7c627e91 /tests | |
parent | deb8222d6994dca12be65146189859c9b76ed9a5 (diff) | |
download | docker-py-1702-build-logs-dockerclient.tar.gz |
ImageCollection.build now also returns build logs along with the built image reference1702-build-logs-dockerclient
BuildError.build_logs has a copy of the logs generator
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/models_images_test.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/integration/models_images_test.py b/tests/integration/models_images_test.py index 8840e15..900555d 100644 --- a/tests/integration/models_images_test.py +++ b/tests/integration/models_images_test.py @@ -10,27 +10,30 @@ class ImageCollectionTest(BaseIntegrationTest): def test_build(self): client = docker.from_env(version=TEST_API_VERSION) - image = client.images.build(fileobj=io.BytesIO( + image, _ = client.images.build(fileobj=io.BytesIO( "FROM alpine\n" "CMD echo hello world".encode('ascii') )) self.tmp_imgs.append(image.id) assert client.containers.run(image) == b"hello world\n" - @pytest.mark.xfail(reason='Engine 1.13 responds with status 500') + # @pytest.mark.xfail(reason='Engine 1.13 responds with status 500') def test_build_with_error(self): client = docker.from_env(version=TEST_API_VERSION) with self.assertRaises(docker.errors.BuildError) as cm: client.images.build(fileobj=io.BytesIO( "FROM alpine\n" - "NOTADOCKERFILECOMMAND".encode('ascii') + "RUN exit 1".encode('ascii') )) - assert str(cm.exception) == ("Unknown instruction: " - "NOTADOCKERFILECOMMAND") + print(cm.exception) + assert str(cm.exception) == ( + "The command '/bin/sh -c exit 1' returned a non-zero code: 1" + ) + assert cm.exception.build_log def test_build_with_multiple_success(self): client = docker.from_env(version=TEST_API_VERSION) - image = client.images.build( + image, _ = client.images.build( tag='some-tag', fileobj=io.BytesIO( "FROM alpine\n" "CMD echo hello world".encode('ascii') @@ -41,7 +44,7 @@ class ImageCollectionTest(BaseIntegrationTest): def test_build_with_success_build_output(self): client = docker.from_env(version=TEST_API_VERSION) - image = client.images.build( + image, _ = client.images.build( tag='dup-txt-tag', fileobj=io.BytesIO( "FROM alpine\n" "CMD echo Successfully built abcd1234".encode('ascii') |