Skip to content

Commit 17c8642

Browse files
authored
Merge pull request #2382 from thaJeztah/fix_platform_tests
Adjust `--platform` tests for changes in docker engine
2 parents b20b10c + bc46490 commit 17c8642

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tests/integration/api_build_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,10 @@ def test_build_invalid_platform(self):
448448
for _ in stream:
449449
pass
450450

451-
assert excinfo.value.status_code == 400
452-
assert 'invalid platform' in excinfo.exconly()
451+
# Some API versions incorrectly returns 500 status; assert 4xx or 5xx
452+
assert excinfo.value.is_error()
453+
assert 'unknown operating system' in excinfo.exconly() \
454+
or 'invalid platform' in excinfo.exconly()
453455

454456
def test_build_out_of_context_dockerfile(self):
455457
base_dir = tempfile.mkdtemp()

tests/integration/api_image_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ def test_pull_invalid_platform(self):
6969
with pytest.raises(docker.errors.APIError) as excinfo:
7070
self.client.pull('hello-world', platform='foobar')
7171

72-
assert excinfo.value.status_code == 500
73-
assert 'invalid platform' in excinfo.exconly()
72+
# Some API versions incorrectly returns 500 status; assert 4xx or 5xx
73+
assert excinfo.value.is_error()
74+
assert 'unknown operating system' in excinfo.exconly() \
75+
or 'invalid platform' in excinfo.exconly()
7476

7577

7678
class CommitTest(BaseAPIIntegrationTest):

0 commit comments

Comments
 (0)