summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Li <orpheus+devel@gmail.com>2016-11-11 16:29:43 +0000
committerSimon Li <orpheus+devel@gmail.com>2016-11-11 16:29:43 +0000
commitcb967ef6825d62d10d2bebeda5ab89be8056a014 (patch)
treea6a8464e847fe275c0994d4e867c1963fec9fd64
parent6fad0855b5abdde54c1c6993893c74277dd03aa8 (diff)
downloaddocker-py-cb967ef6825d62d10d2bebeda5ab89be8056a014.tar.gz
Add test for creating service with env
Signed-off-by: Simon Li <orpheus+devel@gmail.com>
-rw-r--r--tests/integration/service_test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py
index 636f507..0725663 100644
--- a/tests/integration/service_test.py
+++ b/tests/integration/service_test.py
@@ -231,3 +231,19 @@ class ServiceTest(BaseIntegrationTest):
'PublishedPort': 12357, 'TargetPort': 1990, 'Protocol': 'udp'
} in ports
assert len(ports) == 3
+
+ def test_create_service_with_env(self):
+ container_spec = docker.types.ContainerSpec(
+ 'busybox', ['true'], env={'DOCKER_PY_TEST': 1}
+ )
+ task_tmpl = docker.types.TaskTemplate(
+ container_spec,
+ )
+ name = self.get_service_name()
+ svc_id = self.client.create_service(task_tmpl, name=name)
+ svc_info = self.client.inspect_service(svc_id)
+ assert 'TaskTemplate' in svc_info['Spec']
+ assert 'ContainerSpec' in svc_info['Spec']['TaskTemplate']
+ con_spec = svc_info['Spec']['TaskTemplate']['ContainerSpec']
+ assert 'Env' in con_spec
+ assert con_spec['Env'] == ['DOCKER_PY_TEST=1']