classify whether constraint error or affinity error

Signed-off-by: Sun Hongliang <allen.sun@daocloud.io>
This commit is contained in:
Sun Hongliang 2016-03-18 21:51:31 +08:00
parent a91f1818c4
commit 01fc95fe31
3 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ func (f *AffinityFilter) Filter(config *cluster.ContainerConfig, nodes []*node.N
}
}
if len(candidates) == 0 {
return nil, fmt.Errorf("unable to find a node that satisfies %s%s%s", affinity.key, OPERATORS[affinity.operator], affinity.value)
return nil, fmt.Errorf("unable to find a node that satisfies the affinity %s%s%s", affinity.key, OPERATORS[affinity.operator], affinity.value)
}
nodes = candidates
}

View File

@ -45,7 +45,7 @@ func (f *ConstraintFilter) Filter(config *cluster.ContainerConfig, nodes []*node
}
}
if len(candidates) == 0 {
return nil, fmt.Errorf("unable to find a node that satisfies %s%s%s", constraint.key, OPERATORS[constraint.operator], constraint.value)
return nil, fmt.Errorf("unable to find a node that satisfies the constraint %s%s%s", constraint.key, OPERATORS[constraint.operator], constraint.value)
}
nodes = candidates
}

View File

@ -209,7 +209,7 @@ function teardown() {
run docker_swarm run -d --name test_container -e constraint:node==node-1 busyboxabcde sleep 1000
# check error message
[[ "${output}" != *"unable to find a node that satisfies"* ]]
[[ "${output}" != *"unable to find a node that satisfies the constraint"* ]]
[[ "${output}" == *"not found"* ]]
}