Skip to content

Commit 663c608

Browse files
committed
Fix test to make sure the initial mode is replicated
Signed-off-by: Felipe Ruhland <[email protected]>
1 parent 0e0a852 commit 663c608

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docker/models/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def scale(self, replicas):
116116
``True``if successful.
117117
"""
118118

119-
if not self.attrs['Spec']['Mode'].get('Global'):
119+
if 'Global' in self.attrs['Spec']['Mode'].keys():
120120
raise InvalidArgument('Cannot scale a global container')
121121

122122
service_mode = ServiceMode('replicated', replicas)

tests/integration/models_services_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .. import helpers
66
from .base import TEST_API_VERSION
77
from docker.errors import InvalidArgument
8-
from docker.models.services import ServiceMode
8+
from docker.types.services import ServiceMode
99

1010

1111
class ServiceTest(unittest.TestCase):
@@ -212,7 +212,7 @@ def test_scale_method_service(self):
212212
name=helpers.random_name(),
213213
# ContainerSpec arguments
214214
image="alpine",
215-
command="sleep 300"
215+
command="sleep 300",
216216
)
217217
tasks = []
218218
while len(tasks) == 0:

0 commit comments

Comments
 (0)