diff options
author | Noah Eisen <ncteisen@gmail.com> | 2017-10-27 13:21:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-27 13:21:11 -0700 |
commit | 9ba487c82dcb58fd10e56ba9811bb19cb3ca11fd (patch) | |
tree | 5da505b99968ac8386c588435a8d5a50f5f1a076 | |
parent | 21c6405dea681e7880ac96f37208491bfd603d45 (diff) | |
parent | 7721456d907f81747d1c35d7a297ab3c841bc467 (diff) |
Merge pull request #13158 from ncteisen/fix-p0
Fix Timing Test Bug
-rw-r--r-- | test/core/transport/status_conversion_test.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.c index de8fa4458a..02dad86693 100644 --- a/test/core/transport/status_conversion_test.c +++ b/test/core/transport/status_conversion_test.c @@ -38,6 +38,7 @@ int main(int argc, char **argv) { int i; grpc_test_init(argc, argv); + grpc_init(); GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_OK, GRPC_HTTP2_NO_ERROR); GRPC_STATUS_TO_HTTP2_ERROR(GRPC_STATUS_CANCELLED, GRPC_HTTP2_CANCEL); @@ -129,6 +130,11 @@ int main(int argc, char **argv) { GRPC_STATUS_INTERNAL); HTTP2_ERROR_TO_GRPC_STATUS(GRPC_HTTP2_REFUSED_STREAM, after_deadline, GRPC_STATUS_UNAVAILABLE); + // We only have millisecond granularity in our timing code. This sleeps for 5 + // millis to ensure that the status conversion code will pick up the fact + // that the deadline has expired. + gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_millis(5, GPR_TIMESPAN))); HTTP2_ERROR_TO_GRPC_STATUS(GRPC_HTTP2_CANCEL, after_deadline, GRPC_STATUS_DEADLINE_EXCEEDED); HTTP2_ERROR_TO_GRPC_STATUS(GRPC_HTTP2_COMPRESSION_ERROR, after_deadline, @@ -158,5 +164,7 @@ int main(int argc, char **argv) { grpc_http2_status_to_grpc_status(i); } + grpc_shutdown(); + return 0; } |