summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2016-08-18 17:11:12 -0700
committerJohn Keiser <john@johnkeiser.com>2016-08-22 11:57:26 -0700
commit07da07564be03070ac9a107faf77a33bb7270614 (patch)
tree0f825a6f6ea3b59c45cb33e2d7177c7a559cab9a /spec/integration
parent17d1d617c573fe084810a11e542e125f44f7dfc2 (diff)
downloadchef-07da07564be03070ac9a107faf77a33bb7270614.tar.gz
Fix TinyServer races.jk/tinyserver-race
1. Wait for the start callback rather than the do block, as it happens later. This prevents us from getting into many conditions where the start returns before the server is fully initialized, where if stop() is called too soon after start returns, it would cause exceptions. 2. Wait for the thread to finish completely 3. Use Thread.current.abort_on_exception` to show the actual listen errors, so that problems like this can be diagnosed. 4. Use :each to start and stop TinyServer so that race conditions like this are exposed earlier and more often (this will let us rid ourselves of them more quickly). 5. Use WEBrick::HTTPServer directly, which gets rid of the need for the complicated trap workaround (rack is the one that traps).
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/client/client_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 4d406ea495..da3a2b98e4 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -476,11 +476,11 @@ end
# Fails on appveyor, but works locally on windows and on windows hosts in Ci.
context "when using recipe-url", :skip_appveyor do
- before(:all) do
+ before(:each) do
start_tiny_server
end
- after(:all) do
+ after(:each) do
stop_tiny_server
end