Use rspec-retry in flaky brew tests.

We have a few tests that are intermittently flaky. Let's try this to see
if we can get them a bit more reliable.
This commit is contained in:
Mike McQuaid 2018-02-13 09:34:19 +00:00
parent e904983275
commit c57ab279ba
6 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@ require_relative "../constants"
gem "parallel_tests" gem "parallel_tests"
gem "rspec" gem "rspec"
gem "rspec-its", require: false gem "rspec-its", require: false
gem "rspec-retry", require: false
gem "rspec-wait", require: false gem "rspec-wait", require: false
gem "rubocop", HOMEBREW_RUBOCOP_VERSION gem "rubocop", HOMEBREW_RUBOCOP_VERSION

View File

@ -31,6 +31,8 @@ GEM
rspec-mocks (3.6.0) rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0) rspec-support (~> 3.6.0)
rspec-retry (0.5.6)
rspec-core (> 3.3, < 3.8)
rspec-support (3.6.0) rspec-support (3.6.0)
rspec-wait (0.0.9) rspec-wait (0.0.9)
rspec (>= 3, < 4) rspec (>= 3, < 4)
@ -58,9 +60,10 @@ DEPENDENCIES
parallel_tests parallel_tests
rspec rspec
rspec-its rspec-its
rspec-retry
rspec-wait rspec-wait
rubocop (= 0.52.1) rubocop (= 0.52.1)
simplecov simplecov
BUNDLED WITH BUNDLED WITH
1.16.0 1.16.1

View File

@ -25,7 +25,7 @@ describe "brew search", :integration_test do
.and be_a_success .and be_a_success
end end
it "falls back to a GitHub tap search when no formula is found", :needs_network do it "falls back to a GitHub tap search when no formula is found", :needs_network, retry: 3 do
expect { brew "search", "caskroom/cask/firefox" } expect { brew "search", "caskroom/cask/firefox" }
.to output(/firefox/).to_stdout .to output(/firefox/).to_stdout
.and output(/Searching/).to_stderr .and output(/Searching/).to_stderr

View File

@ -1,4 +1,4 @@
describe "brew services", :integration_test, :needs_macos, :needs_network do describe "brew services", :integration_test, :needs_macos, :needs_network, retry: 3 do
it "allows controlling services" do it "allows controlling services" do
setup_remote_tap "homebrew/services" setup_remote_tap "homebrew/services"

View File

@ -6,7 +6,7 @@ describe "brew pull", :integration_test do
.and be_a_failure .and be_a_failure
end end
it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network, retry: 3 do
CoreTap.instance.path.cd do CoreTap.instance.path.cd do
system "git", "init" system "git", "init"
system "git", "checkout", "-b", "new-branch" system "git", "checkout", "-b", "new-branch"

View File

@ -2,6 +2,7 @@ require "find"
require "pathname" require "pathname"
require "rspec/its" require "rspec/its"
require "rspec/wait" require "rspec/wait"
require "rspec/retry"
require "rubocop" require "rubocop"
require "rubocop/rspec/support" require "rubocop/rspec/support"
require "set" require "set"