command: print a warning if we get 0 evaluated nodes
This commit is contained in:
parent
75c79b705e
commit
306a6dc81f
|
@ -272,6 +272,11 @@ func dumpAllocStatus(ui cli.Ui, alloc *api.Allocation) {
|
||||||
alloc.ID, alloc.ClientStatus,
|
alloc.ID, alloc.ClientStatus,
|
||||||
alloc.Metrics.NodesFiltered, alloc.Metrics.NodesEvaluated))
|
alloc.Metrics.NodesFiltered, alloc.Metrics.NodesEvaluated))
|
||||||
|
|
||||||
|
// Print a helpful message if we have an eligibility problem
|
||||||
|
if alloc.Metrics.NodesEvaluated == 0 {
|
||||||
|
ui.Output(" * No nodes were eligible for evaluation")
|
||||||
|
}
|
||||||
|
|
||||||
// Print filter info
|
// Print filter info
|
||||||
for class, num := range alloc.Metrics.ClassFiltered {
|
for class, num := range alloc.Metrics.ClassFiltered {
|
||||||
ui.Output(fmt.Sprintf(" * Class %q filtered %d nodes", class, num))
|
ui.Output(fmt.Sprintf(" * Class %q filtered %d nodes", class, num))
|
||||||
|
|
|
@ -326,4 +326,15 @@ func TestMonitor_DumpAllocStatus(t *testing.T) {
|
||||||
if !strings.Contains(out, `Dimension "cpu" exhausted on 1 nodes`) {
|
if !strings.Contains(out, `Dimension "cpu" exhausted on 1 nodes`) {
|
||||||
t.Fatalf("missing dimension exhaustion\n\n%s", out)
|
t.Fatalf("missing dimension exhaustion\n\n%s", out)
|
||||||
}
|
}
|
||||||
|
ui.OutputWriter.Reset()
|
||||||
|
|
||||||
|
// Dumping alloc status with no eligible nodes adds a warning
|
||||||
|
alloc.Metrics.NodesEvaluated = 0
|
||||||
|
dumpAllocStatus(ui, alloc)
|
||||||
|
|
||||||
|
// Check the output
|
||||||
|
out = ui.OutputWriter.String()
|
||||||
|
if !strings.Contains(out, "No nodes were eligible") {
|
||||||
|
t.Fatalf("missing eligibility warning\n\n%s", out)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue