xetorthio/jedis — pull request #486 by HeartSaVioR (2013-12-02 06:32:38+00:00)
Title: Make unit tests pass both redis 2.6.16 and 2.8.1

First time, I modified unit tests to pass at Redis 2.8.1 (and Redis 2.6).

To pass unit tests at Redis 2.8.1, I've fixed some issues.

* If slave try to promote master itself, New Sentinel forces to demote it
* JedisSentinelTest.clear() has no effect, and wait infinitely
* Slave (6380) is not reusable for another unit tests (as master).
* So I commented JedisSentinelTest.clear(), and add Redis instance for JedisSentinelTest's slave.
* previously JedisSentinelTest uses Redis instance (port 6380) shared to Sharding unit tests.
* ipv6 applied to Redis 2.8
* currently localhost and 127.0.0.1 and ::1 is all same

And I made unit tests passed at Redis 2.6.16 (backward compatibility).

* To pass unit tests at Redis 2.6, you need to make start/test with "OPT_CAN_FAILOVER=yes"
* "sentinel can-failover" is no longer valid at Redis 2.8, and default value is "false" at Redis 2.6
* so failover doesn't occur at Redis 2.6 if we configure sentinel appropriating to Redis 2.8
* if we run "make" with option, "make" append "sentinel can-failover mymaster $(OPT_CAN_FAILOVER)" to configuration's last line
* ttl / pttl returns -2 with non-existence key at Redis 2.8, but still -1 with Redis 2.6.

Redis 2.6.16 is old, but I think not all users immediately changed to Redis 2.8.1 because of stability.
(We still use Redis 2.6.16 for service, and trying to use Redis 2.8.1 for testing)
If Jedis' unit tests needs to pass only at master branch (or latest stable), I'll revert it.

below is commit message

====

* increase sentinel instance to test JedisSentinelTest
* clear() called, slave promoted to master (slave of no one), New
Sentinel force to restore it (demote) -> slave is not reusable
* localhost / 127.0.0.1 / ::1 is all same
* ttl / pttl to non existence key: allow -1 to Redis 2.6 compatibility