diff options
author | Luke Kanies <luke@madstop.com> | 2009-08-18 18:14:10 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-08-24 11:38:19 +1000 |
commit | c7526808c9d2d7efbcc39f33112001bd9bd42b56 (patch) | |
tree | 0a9e3d3ae008941734cd07a3d0b81a75bcddc9a5 /spec | |
parent | ea417d60915fcb68aeebaf750abb57cb5604fe6d (diff) | |
download | puppet-c7526808c9d2d7efbcc39f33112001bd9bd42b56.tar.gz puppet-c7526808c9d2d7efbcc39f33112001bd9bd42b56.tar.xz puppet-c7526808c9d2d7efbcc39f33112001bd9bd42b56.zip |
Fixing a heisenbug resulting from a race condition
We had a case where an expectation could be triggered
before the thread finished, in which case it was marked
as a failure.
We just stub the Thread.new to avoid creating a "real"
thread, thus skipping the race condition.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/network/http/webrick.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb index d0c4b5562..1b76341ba 100755 --- a/spec/unit/network/http/webrick.rb +++ b/spec/unit/network/http/webrick.rb @@ -40,8 +40,10 @@ describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do Proc.new { @server.listen(@listen_params.delete_if {|k,v| :port == k})}.should raise_error(ArgumentError) end - it "should order a webrick server to start" do + it "should order a webrick server to start in a separate thread" do @mock_webrick.expects(:start) + # If you remove this you'll sometimes get race condition problems + Thread.expects(:new).yields @server.listen(@listen_params) end |