fix rounding problem in EchoDeadline test

pull/14238/head
Jan Tattermusch 7 years ago
parent 9233201cc3
commit a3088a6ce8
  1. 7
      test/cpp/end2end/end2end_test.cc

@ -1333,8 +1333,11 @@ TEST_P(ProxyEnd2endTest, EchoDeadline) {
EXPECT_TRUE(s.ok()); EXPECT_TRUE(s.ok());
gpr_timespec sent_deadline; gpr_timespec sent_deadline;
Timepoint2Timespec(deadline, &sent_deadline); Timepoint2Timespec(deadline, &sent_deadline);
// Allow 1 second error. // We want to allow some reasonable error given:
EXPECT_LE(response.param().request_deadline() - sent_deadline.tv_sec, 1); // - request_deadline() only has 1sec resolution so the best we can do is +-1
// - if sent_deadline.tv_nsec is very close to the next second's boundary we
// can end up being off by 2 in one direction.
EXPECT_LE(response.param().request_deadline() - sent_deadline.tv_sec, 2);
EXPECT_GE(response.param().request_deadline() - sent_deadline.tv_sec, -1); EXPECT_GE(response.param().request_deadline() - sent_deadline.tv_sec, -1);
} }

Loading…
Cancel
Save