Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shiraez committed Dec 18, 2024
1 parent 243c46b commit 757c747
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
6 changes: 2 additions & 4 deletions syncd/FlexCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static const std::string COUNTER_TYPE_TUNNEL = "Tunnel Counter";
static const std::string COUNTER_TYPE_BUFFER_POOL = "Buffer Pool Counter";
static const std::string COUNTER_TYPE_ENI = "DASH ENI Counter";
static const std::string COUNTER_TYPE_METER_BUCKET = "DASH Meter Bucket Counter";
static const std::string COUNTER_TYPE_POLICER = "Policer Counter";
static const std::string ATTR_TYPE_QUEUE = "Queue Attribute";
static const std::string ATTR_TYPE_PG = "Priority Group Attribute";
static const std::string ATTR_TYPE_MACSEC_SA = "MACSEC SA Attribute";
Expand Down Expand Up @@ -1731,10 +1732,7 @@ std::shared_ptr<BaseCounterContext> FlexCounter::createCounterContext(
}
else if (context_name == COUNTER_TYPE_POLICER)
{
SWSS_LOG_INFO("createCounterContext counter type %s", context_name.c_str());
auto context = std::make_shared<CounterContext<sai_policer_stat_t>>(context_name, SAI_OBJECT_TYPE_POLICER, m_vendorSai.get(), m_statsMode);
context->always_check_supported_counters = true;
return context;
return std::make_shared<CounterContext<sai_policer_stat_t>>(context_name, SAI_OBJECT_TYPE_POLICER, m_vendorSai.get(), m_statsMode);
}

SWSS_LOG_THROW("Invalid counter type %s", context_name.c_str());
Expand Down
24 changes: 12 additions & 12 deletions unittest/syncd/TestFlexCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,6 @@ TEST(FlexCounter, queryCounterCapability)
{},
counterVerifyFunc,
false);

testAddRemoveCounter(
{sai_object_id_t(0x12000000000000)},
SAI_OBJECT_TYPE_POLICER,
POLICER_COUNTER_ID_LIST,
{"SAI_POLICER_STAT_PACKETS", "SAI_POLICER_STAT_ATTR_BYTES",
"SAI_POLICER_STAT_GREEN_PACKETS", "SAI_POLICER_STAT_GREEN_BYTES",
"SAI_POLICER_STAT_YELLOW_PACKETS", "SAI_POLICER_STAT_YELLOW_BYTES",
"SAI_POLICER_STAT_RED_PACKETS", "SAI_POLICER_STAT_RED_BYTES"},
{"100", "200", "300", "400", "500", "600", "700", "800"},
counterVerifyFunc,
false);
}

TEST(FlexCounter, noSupportedCounters)
Expand Down Expand Up @@ -757,6 +745,18 @@ TEST(FlexCounter, bulkCounter)
{"10", "20"},
counterVerifyFunc,
false);

testAddRemoveCounter(
2,
SAI_OBJECT_TYPE_POLICER,
POLICER_COUNTER_ID_LIST,
{"SAI_POLICER_STAT_PACKETS", "SAI_POLICER_STAT_ATTR_BYTES",
"SAI_POLICER_STAT_GREEN_PACKETS", "SAI_POLICER_STAT_GREEN_BYTES",
"SAI_POLICER_STAT_YELLOW_PACKETS", "SAI_POLICER_STAT_YELLOW_BYTES",
"SAI_POLICER_STAT_RED_PACKETS", "SAI_POLICER_STAT_RED_BYTES"},
{"100", "200", "300", "400", "500", "600", "700", "800"},
counterVerifyFunc,
false);
// buffer pool stats does not support bulk
EXPECT_EQ(false, clearCalled);
}
Expand Down

0 comments on commit 757c747

Please sign in to comment.