File: test_status.py

package info (click to toggle)
python-consul 1.6.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 484 kB
  • sloc: python: 2,858; makefile: 197
file content (19 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class TestStatus:
    def test_status_leader(self, consul_obj) -> None:
        c, _consul_version = consul_obj

        agent_self = c.agent.self()
        leader = c.status.leader()
        addr_port = agent_self["Stats"]["consul"]["leader_addr"]

        assert leader == addr_port, f"Leader value was {leader}, expected value was {addr_port}"

    def test_status_peers(self, consul_obj) -> None:
        c, _consul_version = consul_obj

        agent_self = c.agent.self()

        addr_port = agent_self["Stats"]["consul"]["leader_addr"]
        peers = c.status.peers()

        assert addr_port in peers, f"Expected value '{addr_port}' in peer list but it was not present"