Skip to content

Fix: Issue #2832 Allowing Rollback Config Arg for Services #2917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/models/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def list(self, **kwargs):
'labels',
'mode',
'update_config',
'rollback_config',
'endpoint_spec',
]

Expand Down
7 changes: 6 additions & 1 deletion tests/integration/models_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ def test_create(self):
# ContainerSpec arguments
image="alpine",
command="sleep 300",
container_labels={'container': 'label'}
container_labels={'container': 'label'},
rollback_config={'order': 'start-first'}
)
assert service.name == name
assert service.attrs['Spec']['Labels']['foo'] == 'bar'
container_spec = service.attrs['Spec']['TaskTemplate']['ContainerSpec']
assert "alpine" in container_spec['Image']
assert container_spec['Labels'] == {'container': 'label'}
spec_rollback = service.attrs['Spec'].get('RollbackConfig', None)
assert spec_rollback is not None
assert ('Order' in spec_rollback and
spec_rollback['Order'] == 'start-first')

def test_create_with_network(self):
client = docker.from_env(version=TEST_API_VERSION)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/models_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_get_create_service_kwargs(self):
'labels': {'key': 'value'},
'hostname': 'test_host',
'mode': 'global',
'rollback_config': {'rollback': 'config'},
'update_config': {'update': 'config'},
'networks': ['somenet'],
'endpoint_spec': {'blah': 'blah'},
Expand All @@ -37,6 +38,7 @@ def test_get_create_service_kwargs(self):
'name': 'somename',
'labels': {'key': 'value'},
'mode': 'global',
'rollback_config': {'rollback': 'config'},
'update_config': {'update': 'config'},
'endpoint_spec': {'blah': 'blah'},
}
Expand Down