Skip to content

Commit f88f992

Browse files
authored
[mock_tests] Add Sflow Orch UTs (sonic-net#2295)
- 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 <[email protected]>
1 parent ec57bf1 commit f88f992

File tree

5 files changed

+394
-0
lines changed

5 files changed

+394
-0
lines changed

tests/mock_tests/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ tests_SOURCES = aclorch_ut.cpp \
3131
copporch_ut.cpp \
3232
saispy_ut.cpp \
3333
consumer_ut.cpp \
34+
sfloworh_ut.cpp \
3435
ut_saihelper.cpp \
3536
mock_orchagent_main.cpp \
3637
mock_dbconnector.cpp \

tests/mock_tests/mock_orchagent_main.h

+1
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ extern sai_queue_api_t *sai_queue_api;
8282
extern sai_udf_api_t* sai_udf_api;
8383
extern sai_mpls_api_t* sai_mpls_api;
8484
extern sai_counter_api_t* sai_counter_api;
85+
extern sai_samplepacket_api_t *sai_samplepacket_api;

tests/mock_tests/portal.h

+19
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "aclorch.h"
77
#include "crmorch.h"
88
#include "copporch.h"
9+
#include "sfloworch.h"
910
#include "directory.h"
1011

1112
#undef protected
@@ -82,6 +83,24 @@ struct Portal
8283
}
8384
};
8485

86+
struct SflowOrchInternal
87+
{
88+
static bool getSflowStatusEnable(SflowOrch &obj)
89+
{
90+
return obj.m_sflowStatus;
91+
}
92+
93+
static SflowRateSampleMap getSflowSampleMap(SflowOrch &obj)
94+
{
95+
return obj.m_sflowRateSampleMap;
96+
}
97+
98+
static SflowPortInfoMap getSflowPortInfoMap(SflowOrch &obj)
99+
{
100+
return obj.m_sflowPortInfoMap;
101+
}
102+
};
103+
85104
struct DirectoryInternal
86105
{
87106
template <typename T>

0 commit comments

Comments
 (0)