xetorthio/jedis — pull request #464 by HeartSaVioR (2013-10-07 02:30:48+00:00)
Title: Speed up Sentinel related unit tests (wait for real redis/sentinel status)

In JedisSentinelTest and JedisSentinelPoolTest, there're many FIXMEs to wait for replication and sentinels setup using much time of sleep.
It's so inefficient (wastes some seconds), and tests can fail under some situation. (slow cpu, heavy load to other processes)

I implemented functions to wait based on replication and sentinels status, and JedisSentinelPool's status.
With applying to tests, tests succeed with reasonable sleep.

> FIXME: (In Redis 2.6.16) There're no command for sentinel to list recognized sentinels, so I cannot remove all of sleep codes.

Belows are change notes for commit.

====

* remove FIXME sleep codes for Sentinel related tests
* target : JedisSentinelTest, JedisSentinelPoolTest
* add functions for Sentinel tests (JedisSentinelTestUtil)
* waitForSentinelRecognizeRedisReplication
* waitForNewPromotedMaster
* waitForSentinelsRecognizeEachOthers
* TODO: there're no command for sentinel to list recognized sentinel
* sleep 5.5 sec (sentinel say hello to master's pubsub channel every 5 sec to recognize other sentinels)

* set HostAndPort class to public(no longer inner) class
* reasons
* We cannot know JedisSentinelPool's current master if HostAndPort class is private inner class
* HostAndPort classes are duplicated (main/test)
* make getter method and parameterized constructor
* set fields once, get anytime