Skip to content

Commit 6937a54

Browse files
authored
Merge branch 'main' into span-benchmark
2 parents 85b4d97 + 8a8ffe5 commit 6937a54

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ struct OtlpHttpExporterOptions
6767
bool console_debug = false;
6868

6969
// TODO: Enable/disable to verify SSL certificate
70-
// TODO: Reuqest timeout
7170
std::chrono::milliseconds timeout = std::chrono::milliseconds(30000);
7271
};
7372

exporters/otlp/test/otlp_http_exporter_test.cc

+14-8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS::
8787
}
8888
}
8989

90+
int response_status = 0;
91+
9092
if (request.uri == kDefaultTracePath)
9193
{
9294
response.headers["Content-Type"] = "application/json";
@@ -102,8 +104,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS::
102104
}
103105
else
104106
{
105-
response.body = "{\"code\": 400, \"message\": \"Parse binary failed\"}";
106-
return 400;
107+
response.body = "{\"code\": 400, \"message\": \"Parse binary failed\"}";
108+
response_status = 400;
107109
}
108110
}
109111
else if (nullptr != request_content_type && *request_content_type == kHttpJsonContentType)
@@ -112,8 +114,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS::
112114
response.headers["Content-Type"] = "application/json";
113115
if (json.is_discarded())
114116
{
115-
response.body = "{\"code\": 400, \"message\": \"Parse json failed\"}";
116-
return 400;
117+
response.body = "{\"code\": 400, \"message\": \"Parse json failed\"}";
118+
response_status = 400;
117119
}
118120
else
119121
{
@@ -123,19 +125,23 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS::
123125
}
124126
else
125127
{
126-
response.body = "{\"code\": 400, \"message\": \"Unsupported content type\"}";
127-
return 400;
128+
response.body = "{\"code\": 400, \"message\": \"Unsupported content type\"}";
129+
response_status = 400;
128130
}
129131

130-
return 200;
132+
response_status = 200;
131133
}
132134
else
133135
{
134136
std::unique_lock<std::mutex> lk(mtx_requests);
135137
response.headers["Content-Type"] = "text/plain";
136138
response.body = "404 Not Found";
137-
return 200;
139+
response_status = 200;
138140
}
141+
142+
cv_got_events.notify_one();
143+
144+
return response_status;
139145
}
140146

141147
bool waitForRequests(unsigned timeOutSec, size_t expected_count = 1)

ext/test/http/curl_http_test.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,27 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe
9999
virtual int onHttpRequest(HTTP_SERVER_NS::HttpRequest const &request,
100100
HTTP_SERVER_NS::HttpResponse &response) override
101101
{
102+
int response_status = 404;
102103
if (request.uri == "/get/")
103104
{
104105

105106
std::unique_lock<std::mutex> lk(mtx_requests);
106107
received_requests_.push_back(request);
107108
response.headers["Content-Type"] = "text/plain";
108-
return 200;
109+
response_status = 200;
109110
}
110111
if (request.uri == "/post/")
111112
{
112113
std::unique_lock<std::mutex> lk(mtx_requests);
113114
received_requests_.push_back(request);
114115
response.headers["Content-Type"] = "application/json";
115116
response.body = "{'k1':'v1', 'k2':'v2', 'k3':'v3'}";
116-
return 200;
117+
response_status = 200;
117118
}
118-
return 404;
119+
120+
cv_got_events.notify_one();
121+
122+
return response_status;
119123
}
120124

121125
bool waitForRequests(unsigned timeOutSec, unsigned expected_count = 1)

0 commit comments

Comments
 (0)