Skip to content

Commit fe858f5

Browse files
committed
Add build integration test checking stderr shows up in stream
Signed-off-by: Joffrey F <[email protected]>
1 parent 523e6d4 commit fe858f5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
all: test
44

55
clean:
6+
rm -rf tests/__pycache__
7+
rm -rf tests/*/__pycache__
68
docker rm -vf dpy-dind
79

810
build:

tests/integration/build_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,22 @@ def test_build_with_buildargs(self):
114114

115115
info = self.client.inspect_image('buildargs')
116116
self.assertEqual(info['Config']['User'], 'OK')
117+
118+
def test_build_stderr_data(self):
119+
control_chars = ['\x1b[91m', '\x1b[0m']
120+
snippet = 'Ancient Temple (Mystic Oriental Dream ~ Ancient Temple)'
121+
script = io.BytesIO(b'\n'.join([
122+
b'FROM busybox',
123+
'RUN sh -c ">&2 echo \'{0}\'"'.format(snippet).encode('utf-8')
124+
]))
125+
126+
stream = self.client.build(
127+
fileobj=script, stream=True, decode=True, nocache=True
128+
)
129+
lines = []
130+
for chunk in stream:
131+
lines.append(chunk.get('stream'))
132+
expected = '{0}{2}\n{1}'.format(
133+
control_chars[0], control_chars[1], snippet
134+
)
135+
self.assertTrue(any([line == expected for line in lines]))

0 commit comments

Comments
 (0)