Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Daemon child processes now do a reconnect after forking to ensure tha…
…t redis connections aren't being shared among processes.
- Loading branch information
Hayes Davis
committed
Nov 16, 2010
1 parent
03de097
commit aadb271
Showing
2 changed files
with
34 additions
and
2 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,24 @@ | ||
require File.join(File.dirname(__FILE__),"..","test_helper") | ||
|
||
class ChildProcessTest < Test::Unit::TestCase | ||
|
||
include FlamingoTestCase | ||
|
||
def setup | ||
setup_flamingo | ||
end | ||
|
||
def test_start_forks_and_reconnects_prior_to_run | ||
proc_state = states("proc").starts_as(:new) | ||
proc = Flamingo::Daemon::ChildProcess.new | ||
proc.expects(:fork).when(proc_state.is(:new)).yields.then(proc_state.is(:forked)) | ||
Flamingo.expects(:reconnect!).when(proc_state.is(:forked)).then(proc_state.is(:runnable)) | ||
proc.expects(:run).when(proc_state.is(:runnable)).then(proc_state.is(:running)) | ||
proc.start | ||
end | ||
|
||
def teardown | ||
teardown_flamingo | ||
end | ||
|
||
end |