Kaydet (Commit) cb967ef6 authored tarafından Simon Li's avatar Simon Li

Add test for creating service with env

Signed-off-by: 's avatarSimon Li <orpheus+devel@gmail.com>
üst 6fad0855
......@@ -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']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment