Skip to content

Commit

Permalink
Build cleanup, windows + gmock macros
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Mar 30, 2023
1 parent 340ac8d commit c247437
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions exporters/zipkin/test/zipkin_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ZipkinExporterTestPeer : public ::testing::Test
class MockHttpClient : public opentelemetry::ext::http::client::HttpClientSync
{
public:
# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
# ifdef ENABLE_HTTP_SSL_PREVIEW
MOCK_METHOD(ext::http::client::Result,
Post,
(const nostd::string_view &,
Expand All @@ -73,9 +73,9 @@ class MockHttpClient : public opentelemetry::ext::http::client::HttpClientSync
const ext::http::client::Body &,
const ext::http::client::Headers &),
(noexcept, override));
# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */
# endif /* ENABLE_HTTP_SSL_PREVIEW */

# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
# ifdef ENABLE_HTTP_SSL_PREVIEW
MOCK_METHOD(ext::http::client::Result,
Get,
(const nostd::string_view &,
Expand All @@ -87,7 +87,7 @@ class MockHttpClient : public opentelemetry::ext::http::client::HttpClientSync
Get,
(const nostd::string_view &, const ext::http::client::Headers &),
(noexcept, override));
# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */
# endif /* ENABLE_HTTP_SSL_PREVIEW */
};

class IsValidMessageMatcher
Expand Down Expand Up @@ -166,11 +166,13 @@ TEST_F(ZipkinExporterTestPeer, ExportJsonIntegrationTest)
report_trace_id.assign(trace_id_hex, sizeof(trace_id_hex));

auto expected_url = nostd::string_view{"http://localhost:9411/api/v2/spans"};
EXPECT_CALL(*mock_http_client, Post(expected_url,

# ifdef ENABLE_HTTP_SSL_PREVIEW
_, /* ssl */
# endif /* ENABLE_HTTP_SSL_PREVIEW */
IsValidMessage(report_trace_id), _))
EXPECT_CALL(*mock_http_client, Post(expected_url, _, IsValidMessage(report_trace_id), _))
# else
EXPECT_CALL(*mock_http_client, Post(expected_url, IsValidMessage(report_trace_id), _))
# endif /* ENABLE_HTTP_SSL_PREVIEW */

.Times(Exactly(1))
.WillOnce(Return(ByMove(ext::http::client::Result{
std::unique_ptr<ext::http::client::Response>{new ext::http::client::curl::Response()},
Expand All @@ -194,11 +196,13 @@ TEST_F(ZipkinExporterTestPeer, ShutdownTest)

// exporter should not be shutdown by default
nostd::span<std::unique_ptr<sdk::trace::Recordable>> batch_1(&recordable_1, 1);
EXPECT_CALL(*mock_http_client, Post(_,

# ifdef ENABLE_HTTP_SSL_PREVIEW
_, /* ssl */
# endif /* ENABLE_HTTP_SSL_PREVIEW */
_, _))
EXPECT_CALL(*mock_http_client, Post(_, _, _, _))
# else
EXPECT_CALL(*mock_http_client, Post(_, _, _))
# endif /* ENABLE_HTTP_SSL_PREVIEW */

.Times(Exactly(1))
.WillOnce(Return(ByMove(ext::http::client::Result{
std::unique_ptr<ext::http::client::Response>{new ext::http::client::curl::Response()},
Expand Down

0 comments on commit c247437

Please sign in to comment.