Fix warnings that block the Live CI pipeline (#5398)

* Fix warnings that block the Live CI pipeline

---------

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
Anton Kolesnyk 2024-03-05 00:17:56 -08:00 committed by GitHub
parent 4be69dddcb
commit e4002aeff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 73 additions and 13 deletions

View File

@ -16,8 +16,10 @@
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/trace/provider.h>
#include <opentelemetry/trace/tracer_provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -18,9 +18,11 @@
#pragma warning(disable : 4244)
#pragma warning(disable : 6323)
#endif
#include <opentelemetry/trace/propagation/http_trace_context.h>
#include <opentelemetry/trace/provider.h>
#include <opentelemetry/trace/tracer_provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -14,11 +14,13 @@
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/common/kv_properties.h>
#include <opentelemetry/trace/provider.h>
#include <opentelemetry/trace/span.h>
#include <opentelemetry/trace/tracer.h>
#include <opentelemetry/trace/tracer_provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -15,6 +15,7 @@
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/exporters/memory/in_memory_span_data.h>
#include <opentelemetry/exporters/memory/in_memory_span_exporter.h>
#include <opentelemetry/exporters/ostream/span_exporter.h>
@ -23,6 +24,7 @@
#include <opentelemetry/sdk/trace/processor.h>
#include <opentelemetry/sdk/trace/simple_processor.h>
#include <opentelemetry/sdk/trace/tracer_provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -21,10 +21,12 @@
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/sdk/common/global_log_handler.h>
#include <opentelemetry/sdk/trace/processor.h>
#include <opentelemetry/sdk/trace/simple_processor.h>
#include <opentelemetry/sdk/trace/tracer_provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -6,7 +6,11 @@
#include <memory>
#if defined(_MSC_VER)
// The OpenTelemetry headers generate a couple of warnings on MSVC in the OTel 1.2 package, suppress
// the warnings across the includes.
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif

View File

@ -35,7 +35,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test {
Azure::Storage::Blobs::BlobClientOptions m_blobClientOptions;
};
TEST_F(BlobCheckpointStoreTest, TestCheckpoints)
TEST_F(BlobCheckpointStoreTest, TestCheckpoints_LIVEONLY_)
{
std::string const testName = GetRandomName();
std::string consumerGroup = GetEnv("EVENTHUB_CONSUMER_GROUP");
@ -87,7 +87,7 @@ namespace Azure { namespace Messaging { namespace EventHubs { namespace Test {
EXPECT_EQ(102, checkpoints[0].Offset.Value());
}
TEST_F(BlobCheckpointStoreTest, TestOwnerships)
TEST_F(BlobCheckpointStoreTest, TestOwnerships_LIVEONLY_)
{
std::string const testName = GetRandomName();
auto containerClient{Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(

View File

@ -16,10 +16,13 @@ endif()
# Include sub-projects.
if (BUILD_TESTING)
add_subdirectory ("ut")
# stress tests are categorized as normal tests.
add_subdirectory ("eventhubs-stress-test")
add_subdirectory ("ut")
if (NOT DISABLE_AZURE_CORE_OPENTELEMETRY)
# stress tests are categorized as normal tests.
add_subdirectory ("eventhubs-stress-test")
endif()
endif()
if (BUILD_PERFORMANCE_TESTS)
add_subdirectory ("perf")
add_subdirectory ("perf")
endif()

View File

@ -16,6 +16,15 @@
#include <iostream>
#include <memory>
#if defined(_MSC_VER)
// The OpenTelemetry headers generate a couple of warnings on MSVC in the OTel 1.2 package, suppress
// the warnings across the includes.
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/exporters/otlp/otlp_http_exporter_factory.h>
#include <opentelemetry/exporters/otlp/otlp_http_exporter_options.h>
#include <opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h>
@ -30,6 +39,10 @@
#include <opentelemetry/sdk/trace/tracer_provider_factory.h>
#include <opentelemetry/trace/provider.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
namespace trace_sdk = opentelemetry::sdk::trace;
namespace trace = opentelemetry::trace;
namespace logs_sdk = opentelemetry::sdk::logs;

View File

@ -963,12 +963,16 @@ inline bool flag_is_short(const char* s)
inline bool parser_map::known_short_flag(const char flag) const
{
return this->short_map[flag] != nullptr;
const size_t index = static_cast<size_t>(static_cast<unsigned char>(flag));
const definition* const def = this->short_map[index];
return def != nullptr;
}
inline const definition* parser_map::get_definition_for_short_flag(const char flag) const
{
return this->short_map[flag];
const size_t index = static_cast<size_t>(static_cast<unsigned char>(flag));
const definition* const def = this->short_map[index];
return def;
}
inline bool parser_map::known_long_flag(const std::string& flag) const
@ -1014,7 +1018,7 @@ inline parser_map validate_definitions(const std::vector<definition>& definition
if (flag_is_short(flag.data()))
{
const int short_flag_letter = flag[1];
const size_t short_flag_letter = static_cast<size_t>(flag[1]);
const auto existing_short_flag = map.short_map[short_flag_letter];
bool short_flag_already_exists = (existing_short_flag != nullptr);
if (short_flag_already_exists)
@ -1159,7 +1163,7 @@ inline parser_results parser::parse(int argc, const char** argv, bool posOnly) c
size_t flag_len = arg_i_len;
if (long_flag_arg != nullptr)
{
flag_len = long_flag_arg - arg_i_cstr;
flag_len = static_cast<size_t>(long_flag_arg - arg_i_cstr);
}
std::string long_flag_str(arg_i_cstr, flag_len);
@ -1422,7 +1426,7 @@ namespace convert {
}
else
{
std::string arg_str(begin, s - begin);
std::string arg_str(begin, static_cast<size_t>(s - begin));
out_arg = argagg::convert::arg<T>(arg_str.c_str());
s += 1;
return true;

View File

@ -9,8 +9,21 @@
#include <azure/messaging/eventhubs/consumer_client.hpp>
#include <azure/messaging/eventhubs/producer_client.hpp>
#if defined(_MSC_VER)
// The OpenTelemetry headers generate a couple of warnings on MSVC in the OTel 1.2 package, suppress
// the warnings across the includes.
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/trace/tracer.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
class BatchStressTest : public EventHubsStressScenario {
public:
BatchStressTest();

View File

@ -4,12 +4,25 @@
#pragma once
#include <utility>
#if defined(_MSC_VER)
// The OpenTelemetry headers generate a couple of warnings on MSVC in the OTel 1.2 package, suppress
// the warnings across the includes.
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4244)
#pragma warning(disable : 6323) // Disable "Use of arithmetic operator on Boolean type" warning.
#endif
#include <opentelemetry/logs/provider.h>
#include <opentelemetry/sdk/logs/logger.h>
#include <opentelemetry/sdk/trace/tracer.h>
#include <opentelemetry/trace/provider.h>
#include <opentelemetry/trace/semantic_conventions.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
opentelemetry::nostd::shared_ptr<opentelemetry::logs::Logger> GetLogger();
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> GetTracer();

View File

@ -30,8 +30,8 @@ stages:
CtestRegex: "azure-messaging-eventhubs.*"
LiveTestCtestRegex: "azure-messaging-eventhubs.*"
LiveTestTimeoutInMinutes: 120
LineCoverageTarget: 43
BranchCoverageTarget: 22
LineCoverageTarget: 36
BranchCoverageTarget: 17
Artifacts:
- Name: azure-messaging-eventhubs
Path: azure-messaging-eventhubs