diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index a66aa4c9ba8..beb15bb7750 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -32,6 +32,7 @@ grpc_cc_library( ], deps = [ "//src/proto/grpc/testing:echo_proto", + "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], ) diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index 8f1ec278838..ea84225d5b4 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -163,7 +163,8 @@ ServerUnaryReactor* CallbackTestServiceImpl::Echo( // Set an alarm for that much time alarm_.Set( gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_micros(req_->param().server_sleep_us(), + gpr_time_from_micros(req_->param().server_sleep_us() * + grpc_test_slowdown_factor(), GPR_TIMESPAN)), [this](bool ok) { NonDelayed(ok); }); return; @@ -250,7 +251,8 @@ ServerUnaryReactor* CallbackTestServiceImpl::Echo( } else if (req_->has_param() && req_->param().server_cancel_after_us()) { alarm_.Set(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros( - req_->param().server_cancel_after_us(), + req_->param().server_cancel_after_us() * + grpc_test_slowdown_factor(), GPR_TIMESPAN)), [this](bool) { Finish(Status::CANCELLED); }); return; diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h index 83215c3c78a..18a793ccf9e 100644 --- a/test/cpp/end2end/test_service_impl.h +++ b/test/cpp/end2end/test_service_impl.h @@ -34,6 +34,7 @@ #include #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "test/core/util/test_config.h" #include "test/cpp/util/string_ref_helper.h" namespace grpc { @@ -131,10 +132,11 @@ class TestMultipleServiceImpl : public RpcService { // A bit of sleep to make sure that short deadline tests fail if (request->has_param() && request->param().server_sleep_us() > 0) { - gpr_sleep_until( - gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_micros(request->param().server_sleep_us(), - GPR_TIMESPAN))); + gpr_sleep_until(gpr_time_add( + gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_micros( + request->param().server_sleep_us() * grpc_test_slowdown_factor(), + GPR_TIMESPAN))); } if (request->has_param() && request->param().server_die()) { @@ -176,7 +178,8 @@ class TestMultipleServiceImpl : public RpcService { while (!context->IsCancelled()) { gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(request->param().client_cancel_after_us(), + gpr_time_from_micros(request->param().client_cancel_after_us() * + grpc_test_slowdown_factor(), GPR_TIMESPAN))); } { @@ -188,7 +191,8 @@ class TestMultipleServiceImpl : public RpcService { request->param().server_cancel_after_us()) { gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(request->param().server_cancel_after_us(), + gpr_time_from_micros(request->param().server_cancel_after_us() * + grpc_test_slowdown_factor(), GPR_TIMESPAN))); return Status::CANCELLED; } else if (!request->has_param() ||