Skip to content

Commit fee7f7c

Browse files
committed
Fix memory leak issue in test
1 parent 4aadb2a commit fee7f7c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

sdk/test/trace/tracer_config_test.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,38 @@ std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeVal
3636
std::pair<opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue> attr3 = {
3737
"accept_third_attr", 3};
3838

39-
const instrumentation_scope::InstrumentationScope instrumentation_scopes[] = {
40-
*instrumentation_scope::InstrumentationScope::Create("test_scope_1").get(),
41-
*instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0").get(),
42-
*instrumentation_scope::InstrumentationScope::Create("test_scope_3",
43-
"0",
44-
"https://opentelemetry.io/schemas/v1.18.0")
45-
.get(),
46-
*instrumentation_scope::InstrumentationScope::Create("test_scope_3",
47-
"0",
48-
"https://opentelemetry.io/schemas/v1.18.0",
49-
{attr1})
50-
.get(),
51-
*instrumentation_scope::InstrumentationScope::Create("test_scope_4",
52-
"0",
53-
"https://opentelemetry.io/schemas/v1.18.0",
54-
{attr1, attr2, attr3})
55-
.get(),
39+
const std::array<instrumentation_scope::InstrumentationScope *, 5> instrumentation_scopes = {
40+
instrumentation_scope::InstrumentationScope::Create("test_scope_1").get(),
41+
instrumentation_scope::InstrumentationScope::Create("test_scope_2", "1.0").get(),
42+
instrumentation_scope::InstrumentationScope::Create("test_scope_3",
43+
"0",
44+
"https://opentelemetry.io/schemas/v1.18.0")
45+
.get(),
46+
instrumentation_scope::InstrumentationScope::Create("test_scope_3",
47+
"0",
48+
"https://opentelemetry.io/schemas/v1.18.0",
49+
{attr1})
50+
.get(),
51+
instrumentation_scope::InstrumentationScope::Create("test_scope_4",
52+
"0",
53+
"https://opentelemetry.io/schemas/v1.18.0",
54+
{attr1, attr2, attr3})
55+
.get(),
5656
};
5757

5858
// Test fixture for VerifyDefaultConfiguratorBehavior
5959
class DefaultTracerConfiguratorTestFixture
60-
: public ::testing::TestWithParam<instrumentation_scope::InstrumentationScope>
60+
: public ::testing::TestWithParam<instrumentation_scope::InstrumentationScope *>
6161
{};
6262

6363
// verifies that the default configurator always returns the default tracer config
6464
TEST_P(DefaultTracerConfiguratorTestFixture, VerifyDefaultConfiguratorBehavior)
6565
{
66-
const instrumentation_scope::InstrumentationScope &scope = GetParam();
66+
instrumentation_scope::InstrumentationScope *scope = GetParam();
6767
trace_sdk::TracerConfigurator default_configurator =
6868
trace_sdk::TracerConfig::DefaultConfigurator();
6969

70-
ASSERT_EQ(default_configurator(scope), trace_sdk::TracerConfig::Default());
70+
ASSERT_EQ(default_configurator(*scope), trace_sdk::TracerConfig::Default());
7171
}
7272

7373
INSTANTIATE_TEST_SUITE_P(InstrumentationScopes,

0 commit comments

Comments
 (0)