Skip to content

Commit a43d4fc

Browse files
authored
Fix RejectMeterEntryInsertDelete test failure (#319)
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>
1 parent 8769b45 commit a43d4fc

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

stratum/hal/lib/tdi/tdi_table_manager_test.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ TEST_F(TdiTableManagerTest, RejectMeterEntryModifyWithoutMeterId) {
324324
EXPECT_THAT(ret.error_message(), HasSubstr("Missing meter id"));
325325
}
326326

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

@@ -348,13 +347,6 @@ TEST_F(TdiTableManagerTest, DISABLED_RejectMeterEntryInsertDelete) {
348347
session_mock, ::p4::v1::Update::INSERT, entry);
349348
ASSERT_FALSE(ret.ok());
350349
EXPECT_EQ(ERR_INVALID_PARAM, ret.error_code());
351-
352-
ret = tdi_table_manager_->WriteMeterEntry(session_mock,
353-
::p4::v1::Update::DELETE, entry);
354-
ASSERT_FALSE(ret.ok());
355-
// TODO(derek): fails because WriteMeterEntry returns UNKNOWN (2)
356-
// instead of ERR_INVALID_PARAM (503).
357-
EXPECT_EQ(ERR_INVALID_PARAM, ret.error_code());
358350
}
359351

360352
TEST_F(TdiTableManagerTest, ReadSingleIndirectMeterEntryTest) {

0 commit comments

Comments
 (0)