diff options
author | Tim Smith <tsmith@chef.io> | 2018-11-08 16:19:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-08 16:19:02 -0800 |
commit | e0f96ff64277485eab20b5b91408c65d5db0e937 (patch) | |
tree | 6195cb76340a431e07c0ce29fc8b69f40d481471 | |
parent | b179903ba6bb8b5230cef81bc823cd2cb0eb08b9 (diff) | |
parent | ee517e7d931cf75c3d45813426f64a64a2e26f20 (diff) | |
download | chef-e0f96ff64277485eab20b5b91408c65d5db0e937.tar.gz |
Merge pull request #7899 from chef/lcg/chef-14-fix-knife-integration-timeouts
Chef 14 Backport: fix the knife integration spec timeouts
-rw-r--r-- | spec/integration/knife/raw_spec.rb | 18 | ||||
-rw-r--r-- | spec/integration/knife/redirection_spec.rb | 10 | ||||
-rw-r--r-- | spec/support/shared/integration/app_server_support.rb | 4 |
3 files changed, 19 insertions, 13 deletions
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb index 1c8239746f..04f14be335 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -190,12 +190,14 @@ EOM app = lambda do |env| [200, { "Content-Type" => "application/json" }, ['{ "x": "y", "a": "b" }'] ] end - @raw_server, @raw_server_thread = start_app_server(app, 9018) + @raw_server_thread = start_app_server(app, 9018) end after :each do - @raw_server.shutdown if @raw_server - @raw_server_thread.kill if @raw_server_thread + if @raw_server_thread + @raw_server_thread.kill + @raw_server_thread.join(30) + end end it "knife raw /blah returns the prettified json", skip: (RUBY_VERSION < "1.9") do @@ -220,12 +222,14 @@ EOM app = lambda do |env| [200, { "Content-Type" => "text" }, ['{ "x": "y", "a": "b" }'] ] end - @raw_server, @raw_server_thread = start_app_server(app, 9018) + @raw_server_thread = start_app_server(app, 9018) end after :each do - @raw_server.shutdown if @raw_server - @raw_server_thread.kill if @raw_server_thread + if @raw_server_thread + @raw_server_thread.kill + @raw_server_thread.join(30) + end end it "knife raw /blah returns the raw text" do diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb index 29c1ee6ffb..d387b10e3b 100644 --- a/spec/integration/knife/redirection_spec.rb +++ b/spec/integration/knife/redirection_spec.rb @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,12 +36,14 @@ describe "redirection", :workstation do app = lambda do |env| [302, { "Content-Type" => "text", "Location" => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ["302 found"] ] end - @redirector_server, @redirector_server_thread = start_app_server(app, 9018) + @redirector_server_thread = start_app_server(app, 9018) end after :each do - @redirector_server.shutdown if @redirector_server - @redirector_thread.kill if @redirector_thread + if @redirector_thread + @redirector_thread.kill + @redirector_thread.join(30) + end end it "knife list /roles returns the role" do diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb index c0b24d9443..7f05b14689 100644 --- a/spec/support/shared/integration/app_server_support.rb +++ b/spec/support/shared/integration/app_server_support.rb @@ -1,7 +1,7 @@ # # Author:: John Keiser (<jkeiser@chef.io>) # Author:: Ho-Sheng Hsiao (<hosh@chef.io>) -# Copyright:: Copyright 2012-2016 Chef Software, Inc. +# Copyright:: Copyright 2012-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,6 @@ module AppServerSupport Timeout.timeout(30) do sleep(0.01) until server && server.status == :Running end - [server, thread] + thread end end |