Skip to content

Commit

Permalink
Unit and integration tests added
Browse files Browse the repository at this point in the history
Signed-off-by: WojciechowskiPiotr <devel@it-playground.pl>
  • Loading branch information
WojciechowskiPiotr authored and aiordache committed Feb 15, 2021
1 parent 92e0e9c commit ade4a52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/integration/api_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,19 @@ def test_create_service_with_placement_preferences_tuple(self):
assert 'Placement' in svc_info['Spec']['TaskTemplate']
assert svc_info['Spec']['TaskTemplate']['Placement'] == placemt

@requires_api_version('1.40')
def test_create_service_with_placement_maxreplicas(self):
container_spec = docker.types.ContainerSpec(TEST_IMG, ['true'])
placemt = docker.types.Placement(maxreplicas=1)
task_tmpl = docker.types.TaskTemplate(
container_spec, placement=placemt
)
name = self.get_service_name()
svc_id = self.client.create_service(task_tmpl, name=name)
svc_info = self.client.inspect_service(svc_id)
assert 'Placement' in svc_info['Spec']['TaskTemplate']
assert svc_info['Spec']['TaskTemplate']['Placement'] == placemt

def test_create_service_with_endpoint_spec(self):
container_spec = docker.types.ContainerSpec(TEST_IMG, ['true'])
task_tmpl = docker.types.TaskTemplate(container_spec)
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 @@ -28,6 +28,7 @@ def test_get_create_service_kwargs(self):
'constraints': ['foo=bar'],
'preferences': ['bar=baz'],
'platforms': [('x86_64', 'linux')],
'maxreplicas': 1
})

task_template = kwargs.pop('task_template')
Expand All @@ -47,6 +48,7 @@ def test_get_create_service_kwargs(self):
'Constraints': ['foo=bar'],
'Preferences': ['bar=baz'],
'Platforms': [{'Architecture': 'x86_64', 'OS': 'linux'}],
'MaxReplicas': 1,
}
assert task_template['LogDriver'] == {
'Name': 'logdriver',
Expand Down

0 comments on commit ade4a52

Please sign in to comment.