diff options
author | WojciechowskiPiotr <devel@it-playground.pl> | 2021-02-09 21:37:26 +0100 |
---|---|---|
committer | WojciechowskiPiotr <devel@it-playground.pl> | 2021-02-09 21:37:26 +0100 |
commit | 6d1dffe3e5738ebe02294c795a7e5e630f7913c2 (patch) | |
tree | b88a79406b770ec509ebd4a7b4530efceacdf4fa | |
parent | 514f98a0d69c9350d8f19088e571ddbebfe89b5e (diff) | |
download | docker-py-6d1dffe3e5738ebe02294c795a7e5e630f7913c2.tar.gz |
Unit and integration tests added
Signed-off-by: WojciechowskiPiotr <devel@it-playground.pl>
-rw-r--r-- | tests/integration/api_service_test.py | 13 | ||||
-rw-r--r-- | tests/unit/models_services_test.py | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/integration/api_service_test.py b/tests/integration/api_service_test.py index b6b7ec5..7e5336e 100644 --- a/tests/integration/api_service_test.py +++ b/tests/integration/api_service_test.py @@ -471,6 +471,19 @@ class ServiceTest(BaseAPIIntegrationTest): 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) diff --git a/tests/unit/models_services_test.py b/tests/unit/models_services_test.py index a4ac50c..07bb589 100644 --- a/tests/unit/models_services_test.py +++ b/tests/unit/models_services_test.py @@ -28,6 +28,7 @@ class CreateServiceKwargsTest(unittest.TestCase): 'constraints': ['foo=bar'], 'preferences': ['bar=baz'], 'platforms': [('x86_64', 'linux')], + 'maxreplicas': 1 }) task_template = kwargs.pop('task_template') @@ -47,6 +48,7 @@ class CreateServiceKwargsTest(unittest.TestCase): 'Constraints': ['foo=bar'], 'Preferences': ['bar=baz'], 'Platforms': [{'Architecture': 'x86_64', 'OS': 'linux'}], + 'MaxReplicas': 1, } assert task_template['LogDriver'] == { 'Name': 'logdriver', |