diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-11-08 12:25:53 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-11-08 12:25:53 -0800 |
commit | 8b2c3f13a8cd36812143979616667cc956024f79 (patch) | |
tree | 8d9a0bd9a25c5e2528e70eef898c2182917686b5 /spec/integration/knife | |
parent | ef186512d36533cafdeadfa83b21d20500029705 (diff) | |
download | chef-8b2c3f13a8cd36812143979616667cc956024f79.tar.gz |
fix the knife integration spec timeouts
rely on killing the thread to terminate the server, and rely on
thread#join to correctly signal to the main thread that the
server thread is dead, don't leak the server object out of the
helper.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/integration/knife')
-rw-r--r-- | spec/integration/knife/raw_spec.rb | 18 | ||||
-rw-r--r-- | spec/integration/knife/redirection_spec.rb | 10 |
2 files changed, 17 insertions, 11 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 |