| 392 | } |
| 393 | |
| 394 | func (s *proxyTestSuite) TestPingSimulateFailure() { |
| 395 | ctx, cancel := s.ctx() |
| 396 | defer cancel() |
| 397 | |
| 398 | s.service.simulatePingFailures.Store(1) |
| 399 | defer func() { |
| 400 | s.service.simulatePingFailures.Store(0) |
| 401 | }() |
| 402 | |
| 403 | _, err := s.testClient.Ping(ctx, &pb.PingRequest{Value: "Ciao mamma guarda come mi diverto"}) |
| 404 | s.Require().Error(err, "Ping should return a simulated failure") |
| 405 | s.Require().ErrorContains(err, "Simulated failure") |
| 406 | } |
| 407 | |
| 408 | func (s *proxyTestSuite) setupResiliency() { |
| 409 | timeout := 500 * time.Millisecond |