|
5 | 5 | 'threads' => 8, |
6 | 6 | #'max-clients' => 10000 |
7 | 7 | } |
8 | | - conf.each{|opt, val| |
| 8 | + conf.each{|opt, val| |
9 | 9 | reply = $main_proxy.proxy('config', 'get', opt.to_s) |
10 | 10 | assert_not_redis_err(reply) |
11 | 11 | assert(reply.is_a?(Array), "Expected array reply, got #{reply.class}") |
|
22 | 22 | log = File.read $main_proxy.logfile |
23 | 23 | assert_not_nil(log[msg], "Could not find logged message in proxy's log") |
24 | 24 | end |
| 25 | + |
| 26 | +test "PROXY CLUSTER INFO" do |
| 27 | + reply = $main_proxy.proxy('cluster', 'info') |
| 28 | + assert_not_redis_err(reply) |
| 29 | + assert(reply.is_a?(Array), "Expected array reply, got #{reply.class}") |
| 30 | + assert(reply[0..4] == ["status", "updated", "connection", "shared", "nodes"], "Got unexpected reply: #{reply}") |
| 31 | + reply[5].each{ |node| |
| 32 | + _, name, _, ip, _, port, _, slots, _, replicas, _, connected = node |
| 33 | + assert(ip == "127.0.0.1", "unexpected ip #{ip}") |
| 34 | + assert([18000, 18001, 18002, 18003, 18004, 18005].include?(port), "unexpected port #{port}") |
| 35 | + assert([5461, 5462].include?(slots), "unexpected slots #{slots}") |
| 36 | + assert(replicas == 1, "replicas of #{replicas} != 1") |
| 37 | + assert(connected == 1, "connected of #{connected} != 1") |
| 38 | + } |
| 39 | +end |
| 40 | + |
| 41 | +test "PROXY CLUSTER UPDATE" do |
| 42 | + info_before = $main_proxy.proxy('cluster', 'info') |
| 43 | + assert_not_redis_err(info_before) |
| 44 | + |
| 45 | + update_reply = $main_proxy.proxy('cluster', 'update') |
| 46 | + assert_not_redis_err(update_reply) |
| 47 | + |
| 48 | + info_after = $main_proxy.proxy('cluster', 'info') |
| 49 | + assert_not_redis_err(info_after) |
| 50 | + |
| 51 | + assert(info_before == info_after, "cluster info before update != cluster info after update.\n #{info_before} != #{info_after}") |
| 52 | + |
| 53 | +end |
0 commit comments