-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added reconnect! to Flamingo to ensure close and reopen sockets and f…
…ile descriptors after a fork. This is specifically intended to ensure we don't have issues with interleaved redis commands.
- Loading branch information
Hayes Davis
committed
Nov 16, 2010
1 parent
fe0652c
commit 03de097
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require File.join(File.dirname(__FILE__),"test_helper") | ||
|
||
class FlamingoTest < Test::Unit::TestCase | ||
|
||
|
||
include FlamingoTestCase | ||
|
||
def setup | ||
setup_flamingo | ||
end | ||
|
||
def test_reconnect_reconnects_redis_clients_when_connected | ||
Flamingo.redis.expects(:connected?).returns(true) | ||
Flamingo.redis.expects(:reconnect) | ||
Resque.redis.expects(:connected?).returns(true) | ||
Resque.redis.expects(:reconnect) | ||
Flamingo.reconnect! | ||
end | ||
|
||
def test_reconnect_does_not_reconnect_redis_clients_when_not_connected | ||
Flamingo.redis.expects(:connected?).returns(false) | ||
Flamingo.redis.expects(:reconnect).never | ||
Resque.redis.expects(:connected?).returns(false) | ||
Resque.redis.expects(:reconnect).never | ||
Flamingo.reconnect! | ||
end | ||
|
||
def teardown | ||
teardown_flamingo | ||
end | ||
|
||
|
||
end |