Skip to content

Commit db7f8b8

Browse files
Merge pull request #3296 from thaJeztah/fix_test_create_volume_invalid_driver
integration: test_create_volume_invalid_driver allow either 400 or 404
2 parents 747d23b + fad84c3 commit db7f8b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/integration/api_volume_test.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ def test_create_volume(self):
1717
assert result['Driver'] == 'local'
1818

1919
def test_create_volume_invalid_driver(self):
20-
driver_name = 'invalid.driver'
20+
# special name to avoid exponential timeout loop
21+
# https://github.com/moby/moby/blob/9e00a63d65434cdedc444e79a2b33a7c202b10d8/pkg/plugins/client.go#L253-L254
22+
driver_name = 'this-plugin-does-not-exist'
2123

22-
with pytest.raises(docker.errors.NotFound):
24+
with pytest.raises(docker.errors.APIError) as cm:
2325
self.client.create_volume('perfectcherryblossom', driver_name)
26+
assert (
27+
cm.value.response.status_code == 404 or
28+
cm.value.response.status_code == 400
29+
)
2430

2531
def test_list_volumes(self):
2632
name = 'imperishablenight'

0 commit comments

Comments
 (0)