From e71bda76f87509c4caad55f281b6ffb5c0348ee3 Mon Sep 17 00:00:00 2001 From: Isabel Jimenez Date: Wed, 25 Nov 2015 04:23:56 -0500 Subject: [PATCH] Improving error output for bad swarm mesos user Signed-off-by: Isabel Jimenez --- cluster/mesos/task.go | 6 +++++- test/integration/mesos/api/run.bats | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cluster/mesos/task.go b/cluster/mesos/task.go index 05b9435918..bc7f381346 100644 --- a/cluster/mesos/task.go +++ b/cluster/mesos/task.go @@ -184,7 +184,11 @@ func (t *task) monitor() (bool, []byte, error) { case mesosproto.TaskState_TASK_FINISHED: return true, taskStatus.Data, nil case mesosproto.TaskState_TASK_FAILED: - return true, nil, errors.New(taskStatus.GetMessage()) + errorMessage := taskStatus.GetMessage() + if errorMessage == "Abnormal executor termination" { + errorMessage += " : please verify your SWARM_MESOS_USER is correctly set" + } + return true, nil, errors.New(errorMessage) case mesosproto.TaskState_TASK_KILLED: return true, taskStatus.Data, nil case mesosproto.TaskState_TASK_LOST: diff --git a/test/integration/mesos/api/run.bats b/test/integration/mesos/api/run.bats index 9234ef1855..c174d94735 100644 --- a/test/integration/mesos/api/run.bats +++ b/test/integration/mesos/api/run.bats @@ -8,6 +8,19 @@ function teardown() { stop_docker } +@test "mesos - docker run with wrong user" { + start_docker_with_busybox 2 + start_mesos + swarm_manage --cluster-driver mesos-experimental --cluster-opt mesos.user=test_wrong_user 127.0.0.1:$MESOS_MASTER_PORT + + # run + run docker_swarm run -m 20m -d --name test_container busybox sleep 100 + + # error check + [ "$status" -ne 0 ] + [[ "${output}" == *"please verify your SWARM_MESOS_USER is correctly set"* ]] +} + @test "mesos - docker run" { start_docker_with_busybox 2 start_mesos @@ -62,4 +75,4 @@ function teardown() { run docker_swarm ps -aq [ "${#lines[@]}" -eq 100 ] -} \ No newline at end of file +}