コード例 #1
0
ファイル: test_nodes.py プロジェクト: ceph/shaman
 def test_updates_last_check_time(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health", mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     last_check = n.last_check.time()
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.last_check.time() > last_check
コード例 #2
0
ファイル: test_nodes.py プロジェクト: ceph/shaman
 def test_updates_healthy(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health", mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     n.healthy = False
     session.commit()
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.healthy
コード例 #3
0
 def test_updates_last_check_time(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health",
                         mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     last_check = n.last_check.time()
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.last_check.time() > last_check
コード例 #4
0
 def test_updates_healthy(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health",
                         mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     n.healthy = False
     session.commit()
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.healthy
コード例 #5
0
ファイル: test_util.py プロジェクト: yanghonggang/shaman
 def test_down_count_is_incremented(self, m_get, session):
     m_get.return_value.ok = False
     node = Node("chacra.ceph.com")
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 1
コード例 #6
0
 def test_down_count_is_incremented(self, m_get, session):
     m_get.return_value.ok = False
     node = Node("chacra.ceph.com")
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 1
コード例 #7
0
 def test_node_fails_initial_check(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health",
                         mock_check_node_health(False))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.host == "chacra.ceph.com"
     assert not n.healthy
コード例 #8
0
ファイル: test_util.py プロジェクト: yanghonggang/shaman
 def test_down_count_is_cleared_when_healthy(self, m_get, session):
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     node.down_count = 2
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 0
コード例 #9
0
 def test_node_exceeds_down_count_limit(self, m_get, session):
     m_get.return_value.ok = False
     node = Node("chacra.ceph.com")
     node.down_count = 2
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert not node.healthy
コード例 #10
0
 def test_down_count_is_cleared_when_healthy(self, m_get, session):
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     node.down_count = 2
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 0
コード例 #11
0
ファイル: test_util.py プロジェクト: yanghonggang/shaman
 def test_node_exceeds_down_count_limit(self, m_get, session):
     m_get.return_value.ok = False
     node = Node("chacra.ceph.com")
     node.down_count = 2
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert not node.healthy
コード例 #12
0
ファイル: test_util.py プロジェクト: yanghonggang/shaman
 def test_last_check_is_updated(self, m_get, session):
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     last_check = datetime.datetime.now()
     node.last_check = datetime.datetime.now()
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.last_check.time() > last_check.time()
コード例 #13
0
 def test_last_check_is_updated(self, m_get, session):
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     last_check = datetime.datetime.now()
     node.last_check = datetime.datetime.now()
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.last_check.time() > last_check.time()
コード例 #14
0
ファイル: test_util.py プロジェクト: ceph/shaman
 def test_healthy_is_true_when_rejoining_pool(self, m_get, session):
     """
     Tests the scenario where a node has been marked down,
     but is now up again and needs to rejoin the pool.
     """
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     node.down_count = 3
     node.healthy = False
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 0
     assert node.healthy
コード例 #15
0
ファイル: test_util.py プロジェクト: yanghonggang/shaman
 def test_healthy_is_true_when_rejoining_pool(self, m_get, session):
     """
     Tests the scenario where a node has been marked down,
     but is now up again and needs to rejoin the pool.
     """
     m_get.return_value.ok = True
     node = Node("chacra.ceph.com")
     node.down_count = 3
     node.healthy = False
     session.commit()
     util.is_node_healthy(node)
     node = Node.get(1)
     assert node.down_count == 0
     assert node.healthy
コード例 #16
0
ファイル: test_nodes.py プロジェクト: ceph/shaman
 def test_node_fails_initial_check(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health", mock_check_node_health(False))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.host == "chacra.ceph.com"
     assert not n.healthy
コード例 #17
0
ファイル: test_nodes.py プロジェクト: ceph/shaman
 def test_create_node(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health", mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.host == "chacra.ceph.com"
コード例 #18
0
 def _get_next_node():
     node = Node.get(1)
     return node
コード例 #19
0
ファイル: test_nodes.py プロジェクト: ceph/shaman
 def _get_next_node():
     node = Node.get(1)
     return node
コード例 #20
0
 def test_create_node(self, session, monkeypatch):
     monkeypatch.setattr(nodes, "check_node_health",
                         mock_check_node_health(True))
     session.app.post("/api/nodes/chacra.ceph.com/")
     n = Node.get(1)
     assert n.host == "chacra.ceph.com"