diff options
author | ermolovd <ermolovd@yandex-team.com> | 2024-11-19 10:54:24 +0300 |
---|---|---|
committer | ermolovd <ermolovd@yandex-team.com> | 2024-11-19 11:06:45 +0300 |
commit | 7be946f684e606f5baa9e3a13401cc19b8ac9a3b (patch) | |
tree | a4d6ce2a580ba953a048a64bdedbda1f6c7a1d26 /yt/cpp/mapreduce/http/ut | |
parent | 907667c6ffd6222845fe8e18fd548e508250b5d0 (diff) | |
download | ydb-7be946f684e606f5baa9e3a13401cc19b8ac9a3b.tar.gz |
YT-22943: add context for system errors
* thrown system errors contain context (i.e. host method and request id that produced error)
Type: feature
Component: cpp-sdk
commit_hash:af72a3a37785e9e373e816c2cc072df2076f821d
Diffstat (limited to 'yt/cpp/mapreduce/http/ut')
-rw-r--r-- | yt/cpp/mapreduce/http/ut/connection_pool_ut.cpp | 21 | ||||
-rw-r--r-- | yt/cpp/mapreduce/http/ut/http_ut.cpp | 10 |
2 files changed, 13 insertions, 18 deletions
diff --git a/yt/cpp/mapreduce/http/ut/connection_pool_ut.cpp b/yt/cpp/mapreduce/http/ut/connection_pool_ut.cpp index 90196246c5..fa072675fb 100644 --- a/yt/cpp/mapreduce/http/ut/connection_pool_ut.cpp +++ b/yt/cpp/mapreduce/http/ut/connection_pool_ut.cpp @@ -72,11 +72,10 @@ THolder<TSimpleServer> CreateProxyHttpServer() ui64 port; ParseFirstLine(inputStr, method, host, port, command); - THttpRequest request; const TString hostName = ::TStringBuilder() << host << ":" << port; - request.Connect(hostName); auto header = THttpHeader(method, command); - request.StartRequest(header); + THttpRequest request("0-0-0-0", hostName, header, TDuration::Zero()); + request.StartRequest(); request.FinishRequest(); auto res = request.GetResponseStream(); THttpOutput httpOutput(output); @@ -138,9 +137,8 @@ TEST(TConnectionPool, TestReleaseUnread) const TString hostName = ::TStringBuilder() << "localhost:" << simpleServer->GetPort(); for (size_t i = 0; i != 10; ++i) { - THttpRequest request; - request.Connect(hostName); - request.StartRequest(THttpHeader("GET", "foo")); + THttpRequest request("0-0-0-0", hostName, THttpHeader("GET", "foo"), TDuration::Zero()); + request.StartRequest(); request.FinishRequest(); request.GetResponseStream(); } @@ -155,12 +153,12 @@ TEST(TConnectionPool, TestProxy) const TString hostName2 = ::TStringBuilder() << "localhost:" << simpleServer2->GetPort(); for (size_t i = 0; i != 10; ++i) { - THttpRequest request; - request.Connect(hostName2); auto header = THttpHeader("GET", "foo"); header.SetProxyAddress(hostName2); header.SetHostPort(hostName); - request.StartRequest(header); + + THttpRequest request("0-0-0-0", hostName2, header, TDuration::Zero()); + request.StartRequest(); request.FinishRequest(); request.GetResponseStream(); } @@ -176,9 +174,8 @@ TEST(TConnectionPool, TestConcurrency) const auto func = [&] { for (int i = 0; i != 100; ++i) { - THttpRequest request; - request.Connect(hostName); - request.StartRequest(THttpHeader("GET", "foo")); + THttpRequest request("0-0-0-0", hostName, THttpHeader("GET", "foo"), TDuration::Zero()); + request.StartRequest(); request.FinishRequest(); auto res = request.GetResponseStream(); res->ReadAll(); diff --git a/yt/cpp/mapreduce/http/ut/http_ut.cpp b/yt/cpp/mapreduce/http/ut/http_ut.cpp index ca260841d0..e41e83c5a0 100644 --- a/yt/cpp/mapreduce/http/ut/http_ut.cpp +++ b/yt/cpp/mapreduce/http/ut/http_ut.cpp @@ -70,9 +70,8 @@ TEST(TFramingTest, FramingSimple) { auto server = CreateFramingEchoServer(); - THttpRequest request; - request.Connect(server->GetAddress()); - auto requestStream = request.StartRequest(THttpHeader("POST", "concatenate")); + THttpRequest request("0-0-0-0", server->GetAddress(), THttpHeader("POST", "concatenate"), TDuration::Zero()); + auto requestStream = request.StartRequest(); *requestStream << "Some funny data"; request.FinishRequest(); auto response = request.GetResponseStream()->ReadAll(); @@ -83,9 +82,8 @@ TEST(TFramingTest, FramingLarge) { auto server = CreateFramingEchoServer(); - THttpRequest request; - request.Connect(server->GetAddress()); - auto requestStream = request.StartRequest(THttpHeader("POST", "concatenate")); + THttpRequest request("0-0-0-0", server->GetAddress(), THttpHeader("POST", "concatenate"), TDuration::Zero()); + auto requestStream = request.StartRequest(); auto data = TString(100000, 'x'); *requestStream << data; request.FinishRequest(); |