Skip to content

Commit

Permalink
Supply mock test for QoS
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Aug 16, 2022
1 parent c01aeae commit 4004910
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/mock_tests/qosorch_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,4 +1337,35 @@ namespace qosorch_test

testing_wred_thresholds = false;
}

/*
* Make sure empty fields won't cause orchagent crash
*/
TEST_F(QosOrchTest, QosOrchTestEmptyField)
{
// Create a new dscp to tc map
std::deque<KeyOpFieldsValuesTuple> entries;
entries.push_back({"Ethernet0", "SET",
{
{"dscp_to_tc_map", ""}
}});
auto consumer = dynamic_cast<Consumer *>(gQosOrch->getExecutor(CFG_PORT_QOS_MAP_TABLE_NAME));
consumer->addToSync(entries);
entries.clear();

entries.push_back({"Ethernet0|3", "SET",
{
{"scheduler", ""}
}});
entries.push_back({"Ethernet0|4", "SET",
{
{"wred_profile", ""}
}});
consumer = dynamic_cast<Consumer *>(gQosOrch->getExecutor(CFG_QUEUE_TABLE_NAME));
consumer->addToSync(entries);
entries.clear();

// Drain DSCP_TO_TC_MAP and PORT_QOS_MAP table
static_cast<Orch *>(gQosOrch)->doTask();
}
}

0 comments on commit 4004910

Please sign in to comment.