From dce79b1efa4fffea9abb8fa6b64a959b1df11f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 29 May 2019 13:26:27 +0200 Subject: Add debugging information to flaky test --- spec/bundler/fetcher/compact_index_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb index 5a2d22193a..2f622f6653 100644 --- a/spec/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/fetcher/compact_index_spec.rb @@ -11,11 +11,14 @@ RSpec.describe Bundler::Fetcher::CompactIndex do end describe "#specs_for_names" do + let(:thread_list) { Thread.list.select {|thread| thread.status == "run" } } + let(:thread_inspection) { thread_list.map {|th| " * #{th}:\n #{th.backtrace_locations.join("\n ")}" }.join("\n") } + it "has only one thread open at the end of the run" do compact_index.specs_for_names(["lskdjf"]) - thread_count = Thread.list.count {|thread| thread.status == "run" } - expect(thread_count).to eq 1 + thread_count = thread_list.count + expect(thread_count).to eq(1), "Expected 1 active thread after `#specs_for_names`, but found #{thread_count}. In particular, found:\n#{thread_inspection}" end it "calls worker#stop during the run" do -- cgit v1.2.1