From 2bff102ef3f79fde98da0bfe45e721126632e244 Mon Sep 17 00:00:00 2001 From: Devin Narula Date: Fri, 3 Nov 2023 10:03:43 -0400 Subject: [PATCH] Correctly clearing meter providers --- test/tmetrics.m | 20 ++++++++++---------- test/tmetrics_sdk.m | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/tmetrics.m b/test/tmetrics.m index d869a9e..607602a 100644 --- a/test/tmetrics.m +++ b/test/tmetrics.m @@ -101,7 +101,7 @@ function testAddMetricReader(testCase) % adding a single value ct.add(1); pause(2.5); - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); result_count = numel(results); verifyEqual(testCase,result_count, 2); @@ -136,7 +136,7 @@ function testCounterBasic(testCase) pause(2.5); % fetch result - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; @@ -180,7 +180,7 @@ function testCounterDelta(testCase) % fetch results pause(2.5); - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); dp1 = results{1}.resourceMetrics.scopeMetrics.metrics.sum.dataPoints; dp2 = results{2}.resourceMetrics.scopeMetrics.metrics.sum.dataPoints; @@ -219,7 +219,7 @@ function testCounterAddAttributes(testCase) pause(2.5); % fetch result - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; @@ -263,7 +263,7 @@ function testCounterAddNegative(testCase) pause(2.5); % fetch results - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; dp = results.resourceMetrics.scopeMetrics.metrics.sum.dataPoints; @@ -303,7 +303,7 @@ function testUpDownCounterBasic(testCase) pause(5); % fetch result - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; @@ -348,7 +348,7 @@ function testUpDownCounterAddAttributes(testCase) pause(5); % fetch result - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; dp = results.resourceMetrics.scopeMetrics.metrics.sum.dataPoints; @@ -397,7 +397,7 @@ function testHistogramBasic(testCase) pause(10); % fetch results - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; dp = results.resourceMetrics.scopeMetrics.metrics.histogram.dataPoints; @@ -454,7 +454,7 @@ function testHistogramRecordAttributes(testCase) pause(10); % fetch results - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); results = results{end}; dp = results.resourceMetrics.scopeMetrics.metrics.histogram.dataPoints; @@ -511,7 +511,7 @@ function testHistogramDelta(testCase) pause(2.5); % fetch results - verifyTrue(testCase, p.shutdown()); + clear p; results = readJsonResults(testCase); rsize = size(results); for i = 1:rsize(2) diff --git a/test/tmetrics_sdk.m b/test/tmetrics_sdk.m index 528e7ec..0f27729 100644 --- a/test/tmetrics_sdk.m +++ b/test/tmetrics_sdk.m @@ -53,6 +53,8 @@ function testCustomResource(testCase) pause(2.5); + clear mp; + % perform test comparisons results = readJsonResults(testCase); results = results{1};