1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2011 New Dream Network
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "common/Mutex.h"
16 #include "common/HeartbeatMap.h"
17 #include "common/ceph_context.h"
18 #include "common/config.h"
19 #include "global/global_context.h"
20 #include "gtest/gtest.h"
24 TEST(HeartbeatMap, Healthy) {
25 HeartbeatMap hm(g_ceph_context);
26 heartbeat_handle_d *h = hm.add_worker("one", pthread_self());
28 hm.reset_timeout(h, 9, 18);
29 bool healthy = hm.is_healthy();
30 ASSERT_EQ(healthy, true);
35 TEST(HeartbeatMap, Unhealth) {
36 HeartbeatMap hm(g_ceph_context);
37 heartbeat_handle_d *h = hm.add_worker("one", pthread_self());
39 hm.reset_timeout(h, 1, 3);
41 bool healthy = hm.is_healthy();
42 ASSERT_EQ(healthy, false);