diff options
author | Bundlerbot <bot@bundler.io> | 2019-06-17 10:46:04 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-06-17 10:46:04 +0000 |
commit | 4dc6d1d115802640e4a8c20769c428932f641340 (patch) | |
tree | dc2f3bf862ff65c5154023f5738e4e18e71f9263 | |
parent | 0d4179037d5e0fc72a617f1043df672cf73e2eaa (diff) | |
parent | 81ad85b92de5b4f52045856d9de04d7b85c43570 (diff) | |
download | bundler-4dc6d1d115802640e4a8c20769c428932f641340.tar.gz |
Merge #7202
7202: Fix thread leak in compact index specs r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that sometimes CI fails randomly. For example, https://travis-ci.org/bundler/bundler/jobs/544642885.
### What was your diagnosis of the problem?
My diagnosis was that the spec after it was mocking `Worker#stop` and thus preventing the threads to be actually stopped. That leak would after the spec checking for the number of threads.
### What is your fix for the problem, implemented in this PR?
My fix is to also call the original `#stop` method, so that no threads are left behind.
### Why did you choose this fix out of the possible options?
There's an alternative option, which is to completely remove this spec. In my opinion, this spec is checking exactly the same thing as the previous spec (the whole purpose of `Worker#stop` is to stop threads), but in a more brittle way. So I'm tempted to completely kill the spec instead.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | spec/bundler/fetcher/compact_index_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb index 2f622f6653..f5ae6f4d77 100644 --- a/spec/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/fetcher/compact_index_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Bundler::Fetcher::CompactIndex do end it "calls worker#stop during the run" do - expect_any_instance_of(Bundler::Worker).to receive(:stop).at_least(:once) + expect_any_instance_of(Bundler::Worker).to receive(:stop).at_least(:once).and_call_original compact_index.specs_for_names(["lskdjf"]) end |