mirror of https://github.com/docker/docs.git
Merge pull request #2290 from dgageot/quality-03-simpler-test
Quality 03 simpler test
This commit is contained in:
commit
fa24554871
|
@ -79,39 +79,18 @@ func TestRunActionForeachMachine(t *testing.T) {
|
||||||
|
|
||||||
runActionForeachMachine("start", machines)
|
runActionForeachMachine("start", machines)
|
||||||
|
|
||||||
expected := map[string]state.State{
|
|
||||||
"foo": state.Running,
|
|
||||||
"bar": state.Running,
|
|
||||||
"baz": state.Running,
|
|
||||||
"spam": state.Running,
|
|
||||||
"eggs": state.Running,
|
|
||||||
"ham": state.Running,
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, machine := range machines {
|
for _, machine := range machines {
|
||||||
state, _ := machine.Driver.GetState()
|
machineState, _ := machine.Driver.GetState()
|
||||||
if expected[machine.Name] != state {
|
|
||||||
t.Fatalf("Expected machine %s to have state %s, got state %s", machine.Name, state, expected[machine.Name])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK, now let's stop them all!
|
assert.Equal(t, state.Running, machineState)
|
||||||
expected = map[string]state.State{
|
|
||||||
"foo": state.Stopped,
|
|
||||||
"bar": state.Stopped,
|
|
||||||
"baz": state.Stopped,
|
|
||||||
"spam": state.Stopped,
|
|
||||||
"eggs": state.Stopped,
|
|
||||||
"ham": state.Stopped,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runActionForeachMachine("stop", machines)
|
runActionForeachMachine("stop", machines)
|
||||||
|
|
||||||
for _, machine := range machines {
|
for _, machine := range machines {
|
||||||
state, _ := machine.Driver.GetState()
|
machineState, _ := machine.Driver.GetState()
|
||||||
if expected[machine.Name] != state {
|
|
||||||
t.Fatalf("Expected machine %s to have state %s, got state %s", machine.Name, state, expected[machine.Name])
|
assert.Equal(t, state.Stopped, machineState)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue