Example #1
0
    def test_stats(self):
        """
        Ensure request goes to all servers.
        """
        addrs = [
            IPv4Address('TCP', 'one', 123),
            IPv4Address('TCP', 'two', 456)
        ]
        client = YamClient(addrs, connect=False)
        transports = makeTestConnections(client)

        send = "stats\r\n"
        recv = [
            "STAT foo bar\r\nSTAT egg spam\r\nEND\r\n",
            "STAT baz bar\r\nEND\r\n"
        ]
        results = {
            'one:123': {
                "foo": "bar",
                "egg": "spam"
            },
            'two:456': {
                "baz": "bar"
            }
        }
        yield self._test(client.stats(), transports, send, recv, results)
Example #2
0
    def test_stats(self):
        """
        Ensure request goes to all servers.
        """
        addrs = [IPv4Address('TCP', 'one', 123), IPv4Address('TCP', 'two', 456)]
        client = YamClient(addrs, connect=False)
        transports = makeTestConnections(client)

        send = "stats\r\n"
        recv = ["STAT foo bar\r\nSTAT egg spam\r\nEND\r\n", "STAT baz bar\r\nEND\r\n"]
        results = {'one:123': {"foo": "bar", "egg": "spam"}, 'two:456': {"baz": "bar"}}
        yield self._test(client.stats(), transports, send, recv, results)