Exemplo n.º 1
0
def test_prev_versions(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_2
    get_cluster_info('', 0)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'get AmazonElastiCache:cluster\n'),
    ])
Exemplo n.º 2
0
def test_last_versions(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_1
    get_cluster_info('', 0)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'config get cluster\n'),
    ])
Exemplo n.º 3
0
def test_last_versions(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_1
    get_cluster_info('', 0)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'config get cluster\n'),
    ])
Exemplo n.º 4
0
def test_prev_versions(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_2
    get_cluster_info('', 0)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'get AmazonElastiCache:cluster\n'),
    ])
def test_no_configuration_protocol_support_with_errors(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_4_READ_UNTIL
    client.expect.side_effect = TEST_PROTOCOL_4_EXPECT
    get_cluster_info('test', 0, ignore_cluster_errors=False)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'config get cluster\n'),
    ])
def test_ubuntu_protocol(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_3_READ_UNTIL
    client.expect.side_effect = TEST_PROTOCOL_3_EXPECT

    try:
        get_cluster_info('', 0)
    except WrongProtocolData:
        raise AssertionError('Raised WrongProtocolData with Ubuntu version.')

    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'config get cluster\n'),
    ])
def test_happy_path(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_1_READ_UNTIL
    client.expect.side_effect = TEST_PROTOCOL_1_EXPECT
    info = get_cluster_info('', 0)
    eq_(info['version'], 1)
    eq_(info['nodes'], ['ip:port', 'host:port'])
def test_no_configuration_protocol_support_with_errors_ignored(Telnet):
    client = Telnet.return_value
    client.read_until.side_effect = TEST_PROTOCOL_4_READ_UNTIL
    client.expect.side_effect = TEST_PROTOCOL_4_EXPECT
    info = get_cluster_info('test', 0, ignore_cluster_errors=True)
    client.write.assert_has_calls([
        call(b'version\n'),
        call(b'config get cluster\n'),
    ])
    eq_(info['version'], '1.4.34')
    eq_(info['nodes'], ['test:0'])
Exemplo n.º 9
0
def test_bad_protocol():
    get_cluster_info('', 0)
Exemplo n.º 10
0
def test_bad_protocol():
    get_cluster_info('', 0)