add env support in mesos

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux
2015-07-14 14:47:47 -07:00
parent ef2d11899a
commit b3385caa4e
3 changed files with 38 additions and 1 deletions

View File

@@ -104,6 +104,10 @@ func (t *task) build(slaveID string) {
t.Container.Docker.Parameters = append(t.Container.Docker.Parameters, &mesosproto.Parameter{Key: proto.String("label"), Value: proto.String(fmt.Sprintf("%s=%s", key, value))})
}
for _, value := range t.config.Env {
t.Container.Docker.Parameters = append(t.Container.Docker.Parameters, &mesosproto.Parameter{Key: proto.String("env"), Value: proto.String(value)})
}
t.SlaveId = &mesosproto.SlaveID{Value: &slaveID}
}

View File

@@ -11,7 +11,7 @@ function teardown() {
start_docker_with_busybox 2
swarm_manage
# run container
docker_swarm run -d --name test_container busybox sleep 500
docker_swarm run -d -e TEST=true --name test_container busybox sleep 500
# make sure container exsists
run docker_swarm ps -l
@@ -22,6 +22,7 @@ function teardown() {
run docker_swarm inspect test_container
[ "$status" -eq 0 ]
[[ "${output}" == *"NetworkSettings"* ]]
[[ "${output}" == *"TEST=true"* ]]
# the specific information of swarm node
[[ "${output}" == *'"Node": {'* ]]
[[ "${output}" == *'"Name": "node-'* ]]

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bats
load ../mesos_helpers
function teardown() {
swarm_manage_cleanup
stop_mesos
stop_docker
}
@test "docker inspect" {
start_docker_with_busybox 2
start_mesos
swarm_manage_mesos
# run container
docker_swarm run -d -m 20m -e TEST=true --name test_container busybox sleep 500
# make sure container exsists
run docker_swarm ps -l
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[1]}" == *"test_container"* ]]
# inspect and verify
run docker_swarm inspect test_container
[ "$status" -eq 0 ]
[[ "${output}" == *"NetworkSettings"* ]]
[[ "${output}" == *"TEST=true"* ]]
# the specific information of swarm node
[[ "${output}" == *'"Node": {'* ]]
[[ "${output}" == *'"Name": "node-'* ]]
}