mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 23:15:20 +00:00
[gitlab9] Skeleton unit-tests for kea-netconf implemented.
This commit is contained in:
@@ -30,7 +30,8 @@ if HAVE_GTEST
|
|||||||
|
|
||||||
TESTS += netconf_unittests
|
TESTS += netconf_unittests
|
||||||
|
|
||||||
netconf_unittests_SOURCES = netconf_unittest.cc
|
netconf_unittests_SOURCES = run_unittests.cc
|
||||||
|
netconf_unittests_SOURCES += netconf_env_unittest.cc
|
||||||
|
|
||||||
netconf_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
netconf_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
|
||||||
netconf_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS)
|
netconf_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS)
|
||||||
@@ -52,12 +53,13 @@ netconf_unittests_LDADD = $(top_builddir)/src/bin/netconf/libnetconf.la
|
|||||||
#netconf_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
#netconf_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
|
||||||
#netconf_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
#netconf_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
|
||||||
#netconf_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
#netconf_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
|
||||||
|
netconf_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
|
||||||
netconf_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
netconf_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
|
||||||
netconf_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
|
netconf_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
|
||||||
netconf_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
|
netconf_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
|
||||||
netconf_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
|
netconf_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
|
||||||
netconf_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
|
netconf_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
|
||||||
netconf_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
|
netconf_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD) $(SYSREPO_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
noinst_EXTRA_DIST = configs-list.txt
|
noinst_EXTRA_DIST = configs-list.txt
|
||||||
|
32
src/bin/netconf/tests/netconf_env_unittest.cc
Normal file
32
src/bin/netconf/tests/netconf_env_unittest.cc
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
//
|
||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
/// @brief Basic environment tests for netconf
|
||||||
|
|
||||||
|
|
||||||
|
#include <sysrepo-cpp/Session.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
class NetconfTest : public ::testing::Test {
|
||||||
|
public:
|
||||||
|
|
||||||
|
NetconfTest() {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// This test checks if a session to sysrepo can be established.
|
||||||
|
// It uses sysrepo code directly, so it's a sanity check for the
|
||||||
|
// environment. Doesn't test any Kea code.
|
||||||
|
TEST_F(NetconfTest, environmentSanity) {
|
||||||
|
|
||||||
|
S_Connection conn;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(conn.reset(new Connection("kea-netconf")));
|
||||||
|
|
||||||
|
S_Session sess;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(sess.reset(new Session(conn)));
|
||||||
|
}
|
@@ -6,21 +6,15 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <log/logger_support.h>
|
|
||||||
#include <dhcp4/dhcp4_log.h>
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#include <util/unittests/run_all.h>
|
||||||
|
#include <log/logger_support.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[]) {
|
main(int argc, char* argv[]) {
|
||||||
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
// See the documentation of the KEA_* environment variables in
|
|
||||||
// src/lib/log/README for info on how to tweak logging
|
|
||||||
isc::log::initLogger();
|
isc::log::initLogger();
|
||||||
|
|
||||||
setenv("KEA_PIDFILE_DIR", TEST_DATA_BUILDDIR, 1);
|
return (isc::util::unittests::run_all());
|
||||||
int result = RUN_ALL_TESTS();
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user