(c *testing.T)
| 363 | } |
| 364 | |
| 365 | func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) { |
| 366 | ctx := testutil.GetContext(c) |
| 367 | if runtime.GOARCH == "s390x" { |
| 368 | c.Skip("Disabled on s390x") |
| 369 | } |
| 370 | if runtime.GOARCH == "ppc64le" { |
| 371 | c.Skip("Disabled on ppc64le") |
| 372 | } |
| 373 | |
| 374 | d1 := s.AddDaemon(ctx, c, true, true) |
| 375 | d2 := s.AddDaemon(ctx, c, true, true) |
| 376 | d3 := s.AddDaemon(ctx, c, true, true) |
| 377 | |
| 378 | d1.CreateService(ctx, c, simpleTestService) |
| 379 | |
| 380 | d2.Stop(c) |
| 381 | |
| 382 | // make sure there is a leader |
| 383 | poll.WaitOn(c, pollCheck(c, d1.CheckLeader(ctx), checker.IsNil()), poll.WithTimeout(defaultReconciliationTimeout)) |
| 384 | |
| 385 | d1.CreateService(ctx, c, simpleTestService, func(s *swarm.Service) { |
| 386 | s.Spec.Name = "top1" |
| 387 | }) |
| 388 | |
| 389 | d3.Stop(c) |
| 390 | |
| 391 | var service swarm.Service |
| 392 | simpleTestService(&service) |
| 393 | service.Spec.Name = "top2" |
| 394 | cli := d1.NewClientT(c) |
| 395 | defer cli.Close() |
| 396 | |
| 397 | // d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen |
| 398 | poll.WaitOn(c, pollCheck(c, func(t *testing.T) (any, string) { |
| 399 | _, err := cli.ServiceCreate(testutil.GetContext(t), client.ServiceCreateOptions{ |
| 400 | Spec: service.Spec, |
| 401 | }) |
| 402 | return err.Error(), "" |
| 403 | }, checker.Contains("Make sure more than half of the managers are online.")), poll.WithTimeout(defaultReconciliationTimeout*2)) |
| 404 | |
| 405 | d2.StartNode(c) |
| 406 | |
| 407 | // make sure there is a leader |
| 408 | poll.WaitOn(c, pollCheck(c, d1.CheckLeader(ctx), checker.IsNil()), poll.WithTimeout(defaultReconciliationTimeout)) |
| 409 | |
| 410 | d1.CreateService(ctx, c, simpleTestService, func(s *swarm.Service) { |
| 411 | s.Spec.Name = "top3" |
| 412 | }) |
| 413 | } |
| 414 | |
| 415 | func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *testing.T) { |
| 416 | ctx := testutil.GetContext(c) |
nothing calls this directly
no test coverage detected