Skip to content

Commit

Permalink
Flag flaky tests and environments (i.e. JRuby on Travis)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed May 31, 2015
1 parent cba09b2 commit 78df8af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
require "rspec/its"
require "support/capture_warning"

# Are we in a flaky environment?
def flaky_env?
defined?(JRUBY_VERSION) && ENV["CI"]
end

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
Expand Down
2 changes: 1 addition & 1 deletion spec/support/connection_reuse_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

context "with a socket issue" do
it "transparently reopens" do
it "transparently reopens", :flaky => flaky_env? do
first_socket = client.get("#{server.endpoint}/socket").body.to_s
expect(first_socket).to_not eq("")

Expand Down
4 changes: 2 additions & 2 deletions spec/support/http_handling_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
context "of 0" do
let(:read_timeout) { 0 }

it "times out" do
it "times out", :flaky => flaky_env? do
expect { response }.to raise_error(HTTP::TimeoutError, /Read/i)
end
end
Expand Down Expand Up @@ -183,7 +183,7 @@
context "when disabled" do
let(:options) { {} }

it "opens new sockets" do
it "opens new sockets", :flaky => flaky_env? do
expect(sockets_used).to_not include("")
expect(sockets_used.uniq.length).to eq(2)
end
Expand Down

0 comments on commit 78df8af

Please sign in to comment.