Skip to content

Commit

Permalink
Add ServerConfig tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Sep 20, 2021
1 parent 6842d92 commit 58725df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unittest/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ tests_SOURCES = \
TestZeroMQChannel.cpp \
TestSwitchContainer.cpp \
TestSwitchConfigContainer.cpp \
TestSkipRecordAttrContainer.cpp
TestSkipRecordAttrContainer.cpp \
TestServerConfig.cpp

tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/lib/libSaiRedis.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
Expand Down
15 changes: 15 additions & 0 deletions unittest/lib/TestServerConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "ServerConfig.h"

#include <gtest/gtest.h>

#include <memory>

using namespace sairedis;

TEST(ServerConfig, loadFromFile)
{
EXPECT_NE(ServerConfig::loadFromFile("/not_existing"), nullptr);

EXPECT_NE(ServerConfig::loadFromFile("files/server_config_ok.json"), nullptr);
EXPECT_NE(ServerConfig::loadFromFile("files/server_config_bad.json"), nullptr);
}

0 comments on commit 58725df

Please sign in to comment.