From 307b7b0d151e949024e7ab7ad276b174802a75f2 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Fri, 29 Jul 2016 09:57:28 -0700 Subject: [PATCH] integration: drain node before stop in TestApiSwarmForceNewCluster It's too long to wait for reschedule. Signed-off-by: Alexander Morozov --- integration-cli/docker_api_swarm_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index d6f0f3fe74..90bc6600f5 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -754,9 +754,14 @@ func (s *DockerSwarmSuite) TestApiSwarmForceNewCluster(c *check.C) { id := d1.createService(c, simpleTestService, setInstances(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{ ForceNewCluster: true,