@@ -31,6 +31,8 @@ class SensorClientFormatterTest : public testing::Test {
31
31
SensorClientFormatterTest () : inspector(new sinsp()), formatter(inspector.get(), config) {
32
32
}
33
33
34
+ ~SensorClientFormatterTest () override { CollectorStats::Reset (); }
35
+
34
36
protected:
35
37
std::unique_ptr<sinsp_threadinfo> build_threadinfo (const ThreadInfoParams& params) {
36
38
auto tinfo = inspector->build_threadinfo ();
@@ -72,8 +74,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithoutParentTest) {
72
74
EXPECT_STATS_COUNTER (CollectorStats::process_lineage_string_total, 0 );
73
75
74
76
EXPECT_TRUE (lineage.empty ());
75
-
76
- CollectorStats::Reset ();
77
77
}
78
78
79
79
TEST_F (SensorClientFormatterTest, ProcessWithParentTest) {
@@ -98,8 +98,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithParentTest) {
98
98
99
99
EXPECT_EQ (lineage[0 ].parent_uid (), 42 );
100
100
EXPECT_EQ (lineage[0 ].parent_exec_file_path (), " asdf" );
101
-
102
- CollectorStats::Reset ();
103
101
}
104
102
105
103
TEST_F (SensorClientFormatterTest, ProcessWithParentWithPid0Test) {
@@ -121,8 +119,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithParentWithPid0Test) {
121
119
EXPECT_STATS_COUNTER (CollectorStats::process_lineage_string_total, 0 );
122
120
123
121
EXPECT_TRUE (lineage.empty ());
124
-
125
- CollectorStats::Reset ();
126
122
}
127
123
128
124
TEST_F (SensorClientFormatterTest, ProcessWithParentWithSameNameTest) {
@@ -147,8 +143,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithParentWithSameNameTest) {
147
143
148
144
EXPECT_EQ (lineage[0 ].parent_uid (), 43 );
149
145
EXPECT_EQ (lineage[0 ].parent_exec_file_path (), " asdf" );
150
-
151
- CollectorStats::Reset ();
152
146
}
153
147
154
148
TEST_F (SensorClientFormatterTest, ProcessWithTwoParentsTest) {
@@ -177,8 +171,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithTwoParentsTest) {
177
171
178
172
EXPECT_EQ (lineage[1 ].parent_uid (), 42 );
179
173
EXPECT_EQ (lineage[1 ].parent_exec_file_path (), " asdf" );
180
-
181
- CollectorStats::Reset ();
182
174
}
183
175
184
176
TEST_F (SensorClientFormatterTest, ProcessWithTwoParentsWithTheSameNameTest) {
@@ -204,8 +196,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithTwoParentsWithTheSameNameTest) {
204
196
205
197
EXPECT_EQ (lineage[0 ].parent_uid (), 7 );
206
198
EXPECT_EQ (lineage[0 ].parent_exec_file_path (), " asdf" );
207
-
208
- CollectorStats::Reset ();
209
199
}
210
200
211
201
TEST_F (SensorClientFormatterTest, ProcessCollapseParentChildWithSameNameTest) {
@@ -232,8 +222,6 @@ TEST_F(SensorClientFormatterTest, ProcessCollapseParentChildWithSameNameTest) {
232
222
233
223
EXPECT_EQ (lineage[0 ].parent_uid (), 8 );
234
224
EXPECT_EQ (lineage[0 ].parent_exec_file_path (), " asdf" );
235
-
236
- CollectorStats::Reset ();
237
225
}
238
226
239
227
TEST_F (SensorClientFormatterTest, ProcessCollapseParentChildWithSameName2Test) {
@@ -262,8 +250,6 @@ TEST_F(SensorClientFormatterTest, ProcessCollapseParentChildWithSameName2Test) {
262
250
263
251
EXPECT_EQ (lineage[1 ].parent_uid (), 42 );
264
252
EXPECT_EQ (lineage[1 ].parent_exec_file_path (), " qwerty" );
265
-
266
- CollectorStats::Reset ();
267
253
}
268
254
269
255
TEST_F (SensorClientFormatterTest, ProcessWithUnrelatedProcessTest) {
@@ -293,8 +279,6 @@ TEST_F(SensorClientFormatterTest, ProcessWithUnrelatedProcessTest) {
293
279
294
280
EXPECT_EQ (lineage[1 ].parent_uid (), 42 );
295
281
EXPECT_EQ (lineage[1 ].parent_exec_file_path (), " qwerty" );
296
-
297
- CollectorStats::Reset ();
298
282
}
299
283
300
284
TEST_F (SensorClientFormatterTest, CountTwoCounterCallsTest) {
@@ -312,8 +296,6 @@ TEST_F(SensorClientFormatterTest, CountTwoCounterCallsTest) {
312
296
EXPECT_STATS_COUNTER (CollectorStats::process_lineage_string_total, 0 );
313
297
314
298
EXPECT_TRUE (lineage2.empty ());
315
-
316
- CollectorStats::Reset ();
317
299
}
318
300
319
301
TEST_F (SensorClientFormatterTest, ProcessArguments) {
0 commit comments