@@ -57,20 +57,22 @@ TEST(AttributesProcessor, FilteringExcludeAttributesProcessor)
5757 const int kNumFilterAttributes = 3 ;
5858 std::unordered_map<std::string, bool > filter = {
5959 {" attr2" , true }, {" attr4" , true }, {" attr6" , true }};
60- const int kNumAttributes = 6 ;
61- std::string keys[kNumAttributes ] = {" attr1" , " attr2" , " attr3" , " attr4" , " attr5" , " attr6" };
62- int values[kNumAttributes ] = {10 , 20 , 30 , 40 , 50 , 60 };
63- std::map<std::string, int > attributes = {{keys[0 ], values[0 ]}, {keys[1 ], values[1 ]},
64- {keys[2 ], values[2 ]}, {keys[3 ], values[3 ]},
65- {keys[4 ], values[4 ]}, {keys[5 ], values[5 ]}};
60+ const int kNumAttributes = 7 ;
61+ std::string keys[kNumAttributes ] = {" attr1" , " attr2" , " attr3" , " attr4" ,
62+ " attr5" , " attr6" , " attr7" };
63+ int values[kNumAttributes ] = {10 , 20 , 30 , 40 , 50 , 60 , 70 };
64+ std::map<std::string, int > attributes = {
65+ {keys[0 ], values[0 ]}, {keys[1 ], values[1 ]}, {keys[2 ], values[2 ]}, {keys[3 ], values[3 ]},
66+ {keys[4 ], values[4 ]}, {keys[5 ], values[5 ]}, {keys[6 ], values[6 ]}};
6667 FilteringExcludeAttributesProcessor attributes_processor (filter);
6768 opentelemetry::common::KeyValueIterableView<std::map<std::string, int >> iterable (attributes);
6869 auto filtered_attributes = attributes_processor.process (iterable);
6970 for (auto &e : filtered_attributes)
7071 {
7172 EXPECT_TRUE (filter.find (e.first ) == filter.end ());
7273 }
73- EXPECT_EQ (filter.size (), kNumFilterAttributes );
74+ int expected_filtered_attributes_size = 4 ;
75+ EXPECT_EQ (filtered_attributes.size (), expected_filtered_attributes_size);
7476}
7577
7678TEST (AttributesProcessor, FilteringExcludeAllAttributesProcessor)
@@ -86,5 +88,5 @@ TEST(AttributesProcessor, FilteringExcludeAllAttributesProcessor)
8688 FilteringExcludeAttributesProcessor attributes_processor (filter);
8789 opentelemetry::common::KeyValueIterableView<std::map<std::string, int >> iterable (attributes);
8890 auto filtered_attributes = attributes_processor.process (iterable);
89- EXPECT_EQ (filter .size (), kNumFilterAttributes );
91+ EXPECT_EQ (filtered_attributes .size (), kNumAttributes );
9092}
0 commit comments