Skip to content

Commit

Permalink
try fix grpc timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
kpavlov00 committed Mar 5, 2025
1 parent ff96568 commit 5872afa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions grpc/tests/timeout_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <userver/ugrpc/tests/service_fixtures.hpp>

#include <tests/deadline_helpers.hpp>
#include <tests/unit_test_client.usrv.pb.hpp>
#include <tests/unit_test_client_qos.hpp>
#include <tests/unit_test_service.usrv.pb.hpp>
Expand All @@ -28,7 +29,7 @@ class UnitTestService final : public sample::ugrpc::UnitTestServiceBase {
LOG_DEBUG() << request_counter_ << " request attempt: now=" << std::chrono::system_clock::now()
<< ", deadline=" << context.GetServerContext().deadline();
if (++request_counter_ % 4) {
engine::InterruptibleSleepFor(std::chrono::milliseconds{200});
engine::InterruptibleSleepFor(tests::kShortTimeout + tests::kAddSleep);
EXPECT_TRUE(context.GetServerContext().IsCancelled());
// this status should not reach client because of 'perAttemptRecvTimeout'
LOG_DEBUG() << request_counter_ << ": return ABORTED";
Expand All @@ -51,7 +52,7 @@ using TimeoutTest = ugrpc::tests::ServiceFixture<UnitTestService>;
UTEST_F(TimeoutTest, DISABLED_IN_OLD_GRPC_TEST_NAME(PerAttemptTimeout)) {
ugrpc::client::Qos qos;
qos.attempts = 4;
qos.timeout = std::chrono::milliseconds{100};
qos.timeout = tests::kShortTimeout;
ugrpc::client::ClientQos client_qos;
client_qos.SetDefault(qos);
const auto config = std::vector<dynamic_config::KeyValue>{{tests::kUnitTestClientQos, client_qos}};
Expand Down

0 comments on commit 5872afa

Please sign in to comment.