summaryrefslogtreecommitdiff
path: root/tests/integration/api_build_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/api_build_test.py')
-rw-r--r--tests/integration/api_build_test.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/integration/api_build_test.py b/tests/integration/api_build_test.py
index 609964f..d0aa5c2 100644
--- a/tests/integration/api_build_test.py
+++ b/tests/integration/api_build_test.py
@@ -9,7 +9,7 @@ import pytest
import six
from .base import BaseAPIIntegrationTest
-from ..helpers import requires_api_version
+from ..helpers import requires_api_version, requires_experimental
class BuildTest(BaseAPIIntegrationTest):
@@ -244,6 +244,32 @@ class BuildTest(BaseAPIIntegrationTest):
with pytest.raises(errors.NotFound):
self.client.inspect_image('dockerpytest_nonebuild')
+ @requires_experimental(until=None)
+ @requires_api_version('1.25')
+ def test_build_squash(self):
+ script = io.BytesIO('\n'.join([
+ 'FROM busybox',
+ 'RUN echo blah > /file_1',
+ 'RUN echo blahblah > /file_2',
+ 'RUN echo blahblahblah > /file_3'
+ ]).encode('ascii'))
+
+ def build_squashed(squash):
+ tag = 'squash' if squash else 'nosquash'
+ stream = self.client.build(
+ fileobj=script, tag=tag, squash=squash
+ )
+ self.tmp_imgs.append(tag)
+ for chunk in stream:
+ pass
+
+ return self.client.inspect_image(tag)
+
+ non_squashed = build_squashed(False)
+ squashed = build_squashed(True)
+ self.assertEqual(len(non_squashed['RootFS']['Layers']), 4)
+ self.assertEqual(len(squashed['RootFS']['Layers']), 2)
+
def test_build_stderr_data(self):
control_chars = ['\x1b[91m', '\x1b[0m']
snippet = 'Ancient Temple (Mystic Oriental Dream ~ Ancient Temple)'