Skip to content

Commit

Permalink
[mock_tests] Add Sflow Orch UTs (sonic-net#2295)
Browse files Browse the repository at this point in the history
- What I did
Added Sflow gtest

- Why I did it
Improve sflow orcagent coverage

- How I verified it
ayurkiv@487e531606e9:/sonic/src/sonic-swss/tests/mock_tests$ ./tests --gtest_filter=SflowOrchTest*
Running main() from /build/googletest-YnT0O3/googletest-1.10.0.20201025/googletest/src/gtest_main.cc
Note: Google Test filter = SflowOrchTest*
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from SflowOrchTest
[ RUN      ] SflowOrchTest.SflowEnableDisable
[       OK ] SflowOrchTest.SflowEnableDisable (46 ms)
[ RUN      ] SflowOrchTest.SflowCreateDelete
[       OK ] SflowOrchTest.SflowCreateDelete (46 ms)
[----------] 2 tests from SflowOrchTest (92 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (93 ms total)
[  PASSED  ] 2 tests.

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
  • Loading branch information
ayurkiv-nvda committed Jun 24, 2022
1 parent ec57bf1 commit f88f992
Show file tree
Hide file tree
Showing 5 changed files with 394 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/mock_tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tests_SOURCES = aclorch_ut.cpp \
copporch_ut.cpp \
saispy_ut.cpp \
consumer_ut.cpp \
sfloworh_ut.cpp \
ut_saihelper.cpp \
mock_orchagent_main.cpp \
mock_dbconnector.cpp \
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tests/mock_orchagent_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ extern sai_queue_api_t *sai_queue_api;
extern sai_udf_api_t* sai_udf_api;
extern sai_mpls_api_t* sai_mpls_api;
extern sai_counter_api_t* sai_counter_api;
extern sai_samplepacket_api_t *sai_samplepacket_api;
19 changes: 19 additions & 0 deletions tests/mock_tests/portal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "aclorch.h"
#include "crmorch.h"
#include "copporch.h"
#include "sfloworch.h"
#include "directory.h"

#undef protected
Expand Down Expand Up @@ -82,6 +83,24 @@ struct Portal
}
};

struct SflowOrchInternal
{
static bool getSflowStatusEnable(SflowOrch &obj)
{
return obj.m_sflowStatus;
}

static SflowRateSampleMap getSflowSampleMap(SflowOrch &obj)
{
return obj.m_sflowRateSampleMap;
}

static SflowPortInfoMap getSflowPortInfoMap(SflowOrch &obj)
{
return obj.m_sflowPortInfoMap;
}
};

struct DirectoryInternal
{
template <typename T>
Expand Down
Loading

0 comments on commit f88f992

Please sign in to comment.