integration: drain node before stop in TestApiSwarmForceNewCluster

It's too long to wait for reschedule.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
(cherry picked from commit 307b7b0d15)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Alexander Morozov 2016-07-29 09:57:28 -07:00 committed by Tibor Vass
parent 6811254691
commit af4ff2541a

View file

@ -708,9 +708,14 @@ func (s *DockerSwarmSuite) TestApiSwarmForceNewCluster(c *check.C) {
id := d1.createService(c, simpleTestService, setInstances(instances)) id := d1.createService(c, simpleTestService, setInstances(instances))
waitAndAssert(c, defaultReconciliationTimeout, reducedCheck(sumAsIntegers, d1.checkActiveContainerCount, d2.checkActiveContainerCount), checker.Equals, instances) waitAndAssert(c, defaultReconciliationTimeout, reducedCheck(sumAsIntegers, d1.checkActiveContainerCount, d2.checkActiveContainerCount), checker.Equals, instances)
c.Assert(d2.Stop(), checker.IsNil) // drain d2, all containers should move to d1
d1.updateNode(c, d2.NodeID, func(n *swarm.Node) {
n.Spec.Availability = swarm.NodeAvailabilityDrain
})
waitAndAssert(c, defaultReconciliationTimeout, d1.checkActiveContainerCount, checker.Equals, instances)
waitAndAssert(c, defaultReconciliationTimeout, d2.checkActiveContainerCount, checker.Equals, 0)
time.Sleep(5 * time.Second) c.Assert(d2.Stop(), checker.IsNil)
c.Assert(d1.Init(swarm.InitRequest{ c.Assert(d1.Init(swarm.InitRequest{
ForceNewCluster: true, ForceNewCluster: true,