make the thread count more reliable

Fixes #5766
This commit is contained in:
Pier-Hugues Pellerin 2016-08-16 12:09:12 -04:00
parent aa5c5518cd
commit 2355db583f

View file

@ -64,9 +64,17 @@ describe LogStash::Api::Modules::Node do
context "When asking for human output and threads count" do context "When asking for human output and threads count" do
before(:all) do before(:all) do
# Make sure we have enough threads for this to work.
@threads = []
5.times { @threads << Thread.new { loop {} } }
do_request { get "/hot_threads?human=t&threads=2"} do_request { get "/hot_threads?human=t&threads=2"}
end end
after(:all) do
@threads.each { |t| t.kill } rescue nil
end
let(:payload) { last_response.body } let(:payload) { last_response.body }
it "should return information for <= # requested threads" do it "should return information for <= # requested threads" do