diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h index 777221d23e..0d6f04e653 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h @@ -67,7 +67,6 @@ struct OtlpHttpExporterOptions bool console_debug = false; // TODO: Enable/disable to verify SSL certificate - // TODO: Reuqest timeout std::chrono::milliseconds timeout = std::chrono::milliseconds(30000); }; diff --git a/exporters/otlp/test/otlp_http_exporter_test.cc b/exporters/otlp/test/otlp_http_exporter_test.cc index ef4ab2094e..2dfd32ce05 100644 --- a/exporters/otlp/test/otlp_http_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_exporter_test.cc @@ -87,6 +87,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS:: } } + int response_status = 0; + if (request.uri == kDefaultTracePath) { response.headers["Content-Type"] = "application/json"; @@ -102,8 +104,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS:: } else { - response.body = "{\"code\": 400, \"message\": \"Parse binary failed\"}"; - return 400; + response.body = "{\"code\": 400, \"message\": \"Parse binary failed\"}"; + response_status = 400; } } else if (nullptr != request_content_type && *request_content_type == kHttpJsonContentType) @@ -112,8 +114,8 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS:: response.headers["Content-Type"] = "application/json"; if (json.is_discarded()) { - response.body = "{\"code\": 400, \"message\": \"Parse json failed\"}"; - return 400; + response.body = "{\"code\": 400, \"message\": \"Parse json failed\"}"; + response_status = 400; } else { @@ -123,19 +125,23 @@ class OtlpHttpExporterTestPeer : public ::testing::Test, public HTTP_SERVER_NS:: } else { - response.body = "{\"code\": 400, \"message\": \"Unsupported content type\"}"; - return 400; + response.body = "{\"code\": 400, \"message\": \"Unsupported content type\"}"; + response_status = 400; } - return 200; + response_status = 200; } else { std::unique_lock lk(mtx_requests); response.headers["Content-Type"] = "text/plain"; response.body = "404 Not Found"; - return 200; + response_status = 200; } + + cv_got_events.notify_one(); + + return response_status; } bool waitForRequests(unsigned timeOutSec, size_t expected_count = 1) diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc index 31c0d06570..121dbd143a 100644 --- a/ext/test/http/curl_http_test.cc +++ b/ext/test/http/curl_http_test.cc @@ -99,13 +99,14 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe virtual int onHttpRequest(HTTP_SERVER_NS::HttpRequest const &request, HTTP_SERVER_NS::HttpResponse &response) override { + int response_status = 404; if (request.uri == "/get/") { std::unique_lock lk(mtx_requests); received_requests_.push_back(request); response.headers["Content-Type"] = "text/plain"; - return 200; + response_status = 200; } if (request.uri == "/post/") { @@ -113,9 +114,12 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe received_requests_.push_back(request); response.headers["Content-Type"] = "application/json"; response.body = "{'k1':'v1', 'k2':'v2', 'k3':'v3'}"; - return 200; + response_status = 200; } - return 404; + + cv_got_events.notify_one(); + + return response_status; } bool waitForRequests(unsigned timeOutSec, unsigned expected_count = 1)