Skip to content

Commit

Permalink
Fix RejectMeterEntryInsertDelete test failure (stratum#319)
Browse files Browse the repository at this point in the history
The TdiTableManagerTest::RejectMeterEntryInsertDelete test case
was failing because WriteMeterEntry() was returning UNKNOWN (2)
instead of the expected ERR_INVALID_PARAM. The failure was in
the second half of the test case (the DELETE check).

The INSERT and DELETE checks are unrelated. The former involves
validating the `type` parameter; the latter involves validating
the meter entry. The two do not belong in the same test case.

The objective is to fix a broken test case. Developing new ones
is out of scope.  Removed the DELETE check, renamed the test
case to RejectMeterEntryInsert, and enabled it.

Signed-off-by: Derek Foster <derek.foster@intel.com>
  • Loading branch information
ffoulkes authored Nov 13, 2024
1 parent 8769b45 commit a43d4fc
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions stratum/hal/lib/tdi/tdi_table_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ TEST_F(TdiTableManagerTest, RejectMeterEntryModifyWithoutMeterId) {
EXPECT_THAT(ret.error_message(), HasSubstr("Missing meter id"));
}

// See https://github.com/ipdk-io/stratum-dev/issues/314.
TEST_F(TdiTableManagerTest, DISABLED_RejectMeterEntryInsertDelete) {
TEST_F(TdiTableManagerTest, RejectMeterEntryInsert) {
ASSERT_OK(PushTestConfig());
auto session_mock = std::make_shared<SessionMock>();

Expand All @@ -348,13 +347,6 @@ TEST_F(TdiTableManagerTest, DISABLED_RejectMeterEntryInsertDelete) {
session_mock, ::p4::v1::Update::INSERT, entry);
ASSERT_FALSE(ret.ok());
EXPECT_EQ(ERR_INVALID_PARAM, ret.error_code());

ret = tdi_table_manager_->WriteMeterEntry(session_mock,
::p4::v1::Update::DELETE, entry);
ASSERT_FALSE(ret.ok());
// TODO(derek): fails because WriteMeterEntry returns UNKNOWN (2)
// instead of ERR_INVALID_PARAM (503).
EXPECT_EQ(ERR_INVALID_PARAM, ret.error_code());
}

TEST_F(TdiTableManagerTest, ReadSingleIndirectMeterEntryTest) {
Expand Down

0 comments on commit a43d4fc

Please sign in to comment.