#include <d2srv/d2_tsig_key.h>
#include <hooks/hooks.h>
#include <hooks/hooks_manager.h>
-#include <stats/stats_mgr.h>
using namespace isc::hooks;
using namespace isc::process;
D2CfgMgrPtr tmp = getD2CfgMgr();
update_mgr_.reset(new D2UpdateMgr(queue_mgr_, tmp, getIoService()));
- // Instantiate stats manager.
- // Initialize statistics.
- isc::stats::StatsMgr& stats_mgr = isc::stats::StatsMgr::instance();
- stats_mgr.setMaxSampleCountDefault(0);
- for (const auto& name : D2Stats::ncr) {
- stats_mgr.setValue(name, static_cast<int64_t>(0));
- }
- for (const auto& name : D2Stats::update) {
- stats_mgr.setValue(name, static_cast<int64_t>(0));
- }
+ // Initialize stats manager.
+ D2Stats::init();
};
void
// Verifies that TSIG can be used to sign requests and verify responses.
TEST_F(DNSClientTest, runTSIGTest) {
- ConstElementPtr stats_all = StatsMgr::instance().getAll();
- ASSERT_TRUE(stats_all);
- EXPECT_TRUE(stats_all->empty());
std::string secret ("key number one");
D2TsigKeyPtr key_one;
ASSERT_NO_THROW(key_one.reset(new
secret.c_str(), secret.size())));
checkStats("two.com.", stats_key);
D2TsigKeyPtr nokey;
- StatsMgr::instance().setValue("update-sent", 0LL);
- StatsMgr::instance().setValue("update-signed", 0LL);
- StatsMgr::instance().setValue("update-unsigned", 0LL);
- StatsMgr::instance().setValue("update-success", 0LL);
- StatsMgr::instance().setValue("update-timeout", 0LL);
- StatsMgr::instance().setValue("update-error", 0LL);
// Should be able to send and receive with no keys.
// Neither client nor server will attempt to sign or verify.
runTSIGTest(nokey, key_two);
// Check statistics.
- stats_all = StatsMgr::instance().getAll();
StatMap stats_one = {
{ "update-sent", 3},
{ "update-success", 1},
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
+#include <d2srv/d2_stats.h>
#include <stats_test_utils.h>
using namespace isc::data;
D2StatTest::D2StatTest() {
StatsMgr::instance().removeAll();
+ D2Stats::init();
}
D2StatTest::~D2StatTest() {
#include <config.h>
#include <d2srv/d2_stats.h>
+#include <stats/stats_mgr.h>
using namespace std;
+using namespace isc::stats;
namespace isc {
namespace d2 {
"update-error"
};
+void
+D2Stats::init() {
+ StatsMgr& stats_mgr = isc::stats::StatsMgr::instance();
+ stats_mgr.setMaxSampleCountDefault(0);
+ for (const auto& name : D2Stats::ncr) {
+ stats_mgr.setValue(name, static_cast<int64_t>(0));
+ }
+ for (const auto& name : D2Stats::update) {
+ stats_mgr.setValue(name, static_cast<int64_t>(0));
+ }
+};
+
} // namespace d2
} // namespace isc
/// - update-timeout
/// - update-error
static std::set<std::string> key;
+
+ /// @brief Initialize D2 statistics.
+ ///
+ /// @note: Add default samples if needed.
+ static void init();
};
} // namespace d2