kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
|
Basic testing happens using GTest unit tests with GMock as mocking framework. CMake auto-detects if GTest is installed. However, tests must be explicitly enabled using -DWITH_TESTS=true
. Afterwards, unit tests can be run using CTest.
For building and running the tests, the make target check
exists, automatically building all required targets and running ctest
to execute all unit tests. All test executables reside within the .../test
directory within the build directory and follow the naming convention test_[COMPONENT]_runner
, where COMPONENT
is usually a small part of the software providing a single type of functionality, e.g. an interface for communicating with multiple Redis instances. In many cases, COMPONENT
is just the name of a class for which unit tests have been written.
Some tests require a more advanced system setup, since they depend on other services.
These include:
Advanced tests are enabled by default, but can be disabled on a per-dependency basis using CMake options. The following options allow to control which tests to run:
WITH_HIREDIS_TESTS
– Enable hiredis tests which require a running Redis serverWITH_PGSQL_TESTS
– Enable PostgreSQL tests which require a running PostgreSQL serverWITH_ADMINDB_TESTS
- Enable tests which require a testing AdminDB serverWITH_XMLRPC_TESTS
- Enable tests which require spawning an XML-RPC server in a separate processres/admindb-host-reservation-importer.test.conf
specifying the configuration for the testing database in the localdb
setting analogous to the actual configuration for admindb-host-reservation-importerres/admindb-host-reservation-importer.test.conf
specifying the configuration for the testing AdminDB in the admindb
setting analogous to the actual configuration for admindb-host-reservation-importermyuser
and run ALTER ROLE myuser SUPERUSER;
.