From a2c2b23ec94933828957f098dd66d60496a6534c Mon Sep 17 00:00:00 2001 From: Rodrigo Pastrana Date: Mon, 11 Dec 2023 10:56:26 -0500 Subject: [PATCH] HPCC-30470 codereviewZZZ - Removing unittests - Removing CMAKE entry - Changing string copy Signed-off-by: Rodrigo Pastrana --- system/jlib/jtrace.cpp | 11 +++++------ system/jlib/jtrace.hpp | 2 ++ testing/unittests/CMakeLists.txt | 1 - testing/unittests/jlibtests.cpp | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/system/jlib/jtrace.cpp b/system/jlib/jtrace.cpp index 47e3d047a21..ffe67b6ca30 100644 --- a/system/jlib/jtrace.cpp +++ b/system/jlib/jtrace.cpp @@ -213,10 +213,9 @@ class JLogSpanExporter final : public opentelemetry::sdk::trace::SpanExporter out.append(", \"parent_span_id\": \"").append(16, parentSpanID).append("\""); } - StringAttr ts; - ts.set(span->GetSpanContext().trace_state()->ToHeader().c_str()); - if (!ts.isEmpty()) - out.appendf(", \"trace_state\": \"%s\"", span->GetSpanContext().trace_state()->ToHeader().c_str()); + std::string traceStatestr = span->GetSpanContext().trace_state()->ToHeader(); + if (!traceStatestr.empty()) + out.appendf(", \"trace_state\": \"%s\"", traceStatestr.c_str()); } if (hasMask(logFlags, SpanLogFlags::LogSpanDetails)) @@ -372,7 +371,7 @@ class JLogSpanExporter final : public opentelemetry::sdk::trace::SpanExporter std::atomic_bool shutDown; }; -#ifdef _USE_CPPUNIT +/*#ifdef _USE_CPPUNIT void testJLogExporterPrintAttributes(StringBuffer & out, const std::unordered_map & map, const char * attsContainerName) { JLogSpanExporter::printAttributes(out, map, attsContainerName); @@ -383,7 +382,7 @@ void testJLogExporterPrintResources(StringBuffer & out, const opentelemetry::sdk JLogSpanExporter::printResources(out, resources); } #endif - +*/ class JLogSpanExporterFactory { public: diff --git a/system/jlib/jtrace.hpp b/system/jlib/jtrace.hpp index 198c23ec752..69900cfe62e 100644 --- a/system/jlib/jtrace.hpp +++ b/system/jlib/jtrace.hpp @@ -84,6 +84,7 @@ interface ITraceManager : extends IInterface extern jlib_decl ISpan * getNullSpan(); extern jlib_decl void initTraceManager(const char * componentName, const IPropertyTree * componentConfig, const IPropertyTree * globalConfig); extern jlib_decl ITraceManager & queryTraceManager(); +/* #ifdef _USE_CPPUNIT #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/sdk/resource/resource.h" @@ -91,6 +92,7 @@ extern jlib_decl ITraceManager & queryTraceManager(); extern jlib_decl void testJLogExporterPrintResources(StringBuffer & out, const opentelemetry::sdk::resource::Resource &resources); extern jlib_decl void testJLogExporterPrintAttributes(StringBuffer & out, const std::unordered_map & map, const char * attsContainerName); #endif +*/ //The following class is responsible for ensuring that the active span is restored in a context when the scope is exited diff --git a/testing/unittests/CMakeLists.txt b/testing/unittests/CMakeLists.txt index 6b1b343864d..58153493d35 100644 --- a/testing/unittests/CMakeLists.txt +++ b/testing/unittests/CMakeLists.txt @@ -93,7 +93,6 @@ include_directories ( ${CMAKE_BINARY_DIR}/generated ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/oss - ${HPCC_SOURCE_DIR}/system/globalid ) ADD_DEFINITIONS( -D_CONSOLE ) diff --git a/testing/unittests/jlibtests.cpp b/testing/unittests/jlibtests.cpp index c2ffd526602..3a1ece2eb20 100644 --- a/testing/unittests/jlibtests.cpp +++ b/testing/unittests/jlibtests.cpp @@ -64,8 +64,8 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_TEST(testClientSpanGlobalID); CPPUNIT_TEST(testEnsureTraceID); - CPPUNIT_TEST(testJTraceJLOGExporterprintResources); - CPPUNIT_TEST(testJTraceJLOGExporterprintAttributes); + //CPPUNIT_TEST(testJTraceJLOGExporterprintResources); + //CPPUNIT_TEST(testJTraceJLOGExporterprintAttributes); CPPUNIT_TEST_SUITE_END(); const char * simulatedGlobalYaml = R"!!(global: @@ -110,7 +110,7 @@ class JlibTraceTest : public CppUnit::TestFixture protected: - void testJTraceJLOGExporterprintAttributes() + /*void testJTraceJLOGExporterprintAttributes() { StringBuffer out; testJLogExporterPrintAttributes(out, {}, "attributes"); @@ -144,9 +144,9 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/url")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/content-length")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/content-type")); - } + }*/ - void testJTraceJLOGExporterprintResources() + /*void testJTraceJLOGExporterprintResources() { StringBuffer out; auto dummyAttributes = opentelemetry::sdk::resource::ResourceAttributes @@ -186,7 +186,7 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.language")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.version")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.name")); - } + }*/ void testTraceDisableConfig() {