Skip to content

Commit

Permalink
SRCH-1905 resolve intermittent cucumber failures (#660)
Browse files Browse the repository at this point in the history
- bump test gems
- bump nokogiri
- simplify CircleCi gem installation
- tweak VCR/Webmock settings
  • Loading branch information
MothOnMars authored Feb 16, 2021
1 parent 79f7fe3 commit 2fdaea7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 72 deletions.
31 changes: 7 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

version: 2.1

orbs:
ruby: circleci/[email protected]

executors:
test_executor:
working_directory: ~/search-gov
Expand Down Expand Up @@ -89,18 +92,8 @@ jobs:
- restore_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}

- restore_cache:
key: search-gov-{{ checksum "Gemfile.lock" }}
- ruby/install-deps

- run:
name: Install Dependencies
command: |
bundle install --without development --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
key: search-gov-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle

rspec:
executor: test_executor
Expand All @@ -111,10 +104,7 @@ jobs:
- restore_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}

- restore_cache:
key: search-gov-{{ checksum "Gemfile.lock" }}

- run: bundle --path vendor/bundle
- ruby/install-deps

- prepare_database

Expand Down Expand Up @@ -156,11 +146,7 @@ jobs:
- restore_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}

- restore_cache:
key: search-gov-{{ checksum "Gemfile.lock" }}

- run: bundle --path vendor/bundle

- ruby/install-deps
- prepare_database

- run:
Expand Down Expand Up @@ -201,10 +187,7 @@ jobs:
- restore_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}

- restore_cache:
key: search-gov-{{ checksum "Gemfile.lock" }}

- run: bundle --path vendor/bundle
- ruby/install-deps

- attach_workspace:
at: ~/search-gov/coverage
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem 'mysql2', '~> 0.4.4'
gem 'curb', '~> 0.9.4'
gem 'haml', '~> 5.0.4'
gem 'will_paginate', '~> 3.1.6'
gem 'nokogiri', '~> 1.10.8'
gem 'nokogiri', '~> 1.11.1'
gem 'bcrypt-ruby', '~> 3.1.5', :require => 'bcrypt'
gem 'authlogic', '~> 3.8.0'
gem 'omniauth_login_dot_gov', git: 'https://github.com/18f/omniauth_login_dot_gov.git',
Expand Down
90 changes: 46 additions & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ GEM
airbrake-ruby (2.12.0)
american_date (1.1.1)
arel (9.0.0)
ast (2.4.0)
ast (2.4.2)
authlogic (3.8.0)
activerecord (>= 3.2, < 5.3)
activesupport (>= 3.2, < 5.3)
Expand Down Expand Up @@ -203,15 +203,15 @@ GEM
bindata (2.4.4)
buftok (0.2.0)
builder (3.2.4)
byebug (11.0.1)
byebug (11.1.3)
capybara (2.18.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
capybara-screenshot (1.0.23)
capybara-screenshot (1.0.25)
capybara (>= 1.0, < 4)
launchy
childprocess (3.0.0)
Expand All @@ -222,7 +222,7 @@ GEM
cliver (0.3.2)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (4.2.2)
Expand Down Expand Up @@ -258,8 +258,8 @@ GEM
activerecord (>= 4.2)
activesupport (>= 4.2)
after_commit_action (~> 1.0)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crack (0.4.5)
rexml
crass (1.0.6)
cucumber (3.2.0)
builder (>= 2.1.2)
Expand Down Expand Up @@ -352,7 +352,7 @@ GEM
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faker (1.9.3)
faker (1.9.6)
i18n (>= 0.7)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
Expand Down Expand Up @@ -406,7 +406,7 @@ GEM
tilt
hashdiff (1.0.1)
hashie (3.3.2)
highline (2.0.2)
highline (2.0.3)
html_truncator (0.4.2)
nokogiri (~> 1.5)
htmlentities (4.3.4)
Expand All @@ -425,7 +425,7 @@ GEM
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.29)
i18n-tasks (0.9.33)
activesupport (>= 4.0.2)
ast (>= 2.1.0)
erubi
Expand All @@ -437,7 +437,7 @@ GEM
terminal-table (>= 1.5.1)
ice_nine (0.11.2)
iso8601 (0.10.1)
jaro_winkler (1.5.2)
jaro_winkler (1.5.4)
jbuilder (2.6.4)
activesupport (>= 3.0.0)
multi_json (>= 1.2)
Expand All @@ -448,7 +448,7 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.3.1)
json (2.5.1)
json-jwt (1.11.0)
activesupport (>= 4.2)
aes_key_wrap
Expand Down Expand Up @@ -481,13 +481,13 @@ GEM
memoist (0.16.0)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.9.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
mini_portile2 (2.5.0)
minitest (5.14.3)
mobile-fu (1.4.0)
rack-mobile-detect
Expand All @@ -507,9 +507,10 @@ GEM
naught (1.1.0)
net-http-persistent (2.9.4)
newrelic_rpm (5.0.0.342)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nio4r (2.5.5)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
oj (3.3.10)
omniauth (1.4.3)
hashie (>= 1.2, < 4)
Expand All @@ -525,26 +526,27 @@ GEM
cocaine (~> 0.5.5)
mime-types
mimemagic (~> 0.3.0)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
parallel (1.20.1)
parser (3.0.0.0)
ast (~> 2.4.1)
poltergeist (1.18.1)
capybara (>= 2.1, < 4)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
power_assert (1.1.4)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
powerpack (0.1.3)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.10)
pry (~> 0.13.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.1.1)
puma (3.12.6)
raabro (1.1.6)
racc (1.5.2)
rack (2.2.3)
rack-accept (0.4.5)
rack (>= 0.4)
Expand All @@ -554,7 +556,7 @@ GEM
rack (>= 2.0.0)
rack-mobile-detect (0.4.0)
rack
rack-protection (2.0.5)
rack-protection (2.1.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand All @@ -571,10 +573,10 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.4.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -649,31 +651,32 @@ GEM
rspec-mocks (>= 3.0.0)
retriable (3.1.2)
retry_block (1.2.0)
rexml (3.2.4)
rspec-activemodel-mocks (1.0.3)
activemodel (>= 3.0)
activesupport (>= 3.0)
rspec-mocks (>= 2.99, < 4.0)
rspec-core (3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
rspec-expectations (3.8.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-json_expectations (2.1.0)
rspec-mocks (3.8.1)
rspec-mocks (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
rspec-rails (3.8.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
rspec-support (3.8.3)
rspec_junit_formatter (0.3.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.60.0)
Expand All @@ -686,13 +689,12 @@ GEM
unicode-display_width (~> 1.4.0)
rubocop-rspec (1.35.0)
rubocop (>= 0.60.0)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4)
ruby_dep (1.5.0)
rubyzip (2.3.0)
rufus-scheduler (3.6.0)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
sass (3.3.14)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
Expand Down Expand Up @@ -723,10 +725,10 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sinatra (2.0.5)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.5)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
spring (2.0.2)
activesupport (>= 4.2)
Expand All @@ -738,7 +740,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
temple (0.8.1)
terminal-table (1.8.0)
terminal-table (3.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
test-unit (3.2.9)
power_assert
Expand Down Expand Up @@ -785,7 +787,7 @@ GEM
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
webdrivers (4.4.1)
webdrivers (4.5.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
Expand Down Expand Up @@ -872,7 +874,7 @@ DEPENDENCIES
mysql2 (~> 0.4.4)
net-http-persistent (~> 2.9.3)
newrelic_rpm (~> 5.0.0)
nokogiri (~> 1.10.8)
nokogiri (~> 1.11.1)
oj (~> 3.3.10)
omniauth-rails_csrf_protection (~> 0.1.2)
omniauth_login_dot_gov!
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
i14y_api_url = "#{I14y.host}#{I14yCollections::API_ENDPOINT}/search?"
i14y_web_result = Rails.root.join('spec/fixtures/json/i14y/web_search/marketplace.json').read
i14y_search_params = { handles: 'one,two', language: 'en', offset: 0, query: 'marketplase', size: 20 }
# Avoid making unnecessary requests to test domains
stub_request(:get, /(agency|foo|searchgov)\.gov/).
to_return(body: 'a stubbed web page')
stub_request(:get, "#{i14y_api_url}#{i14y_search_params.to_param}").
to_return( status: 200, body: i14y_web_result )
OmniAuth.config.mock_auth[:default] = OmniAuth::AuthHash.new({})
Expand Down
4 changes: 1 addition & 3 deletions spec/support/shared_vcr_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@
clean_outdated_http_interactions: true,
}

config.ignore_hosts 'example.com', 'codeclimate.com'
config.ignore_hosts 'example.com', 'codeclimate.com', '127.0.0.1'
config.ignore_hosts *DRIVER_HOSTS
config.ignore_request do |request|
/codeclimate.com/ === URI(request.uri).host
end

config.ignore_request { |request| URI(request.uri).port.between?(9200,9299) } #Elasticsearch
config.ignore_request { |request| URI(request.uri).port == 9515 } # Selenium Webdriver
config.ignore_request { |request| URI(request.uri).port == 9517 } # Chrome Webdriver
config.ignore_request { |request| URI(request.uri).port == 9998 } # Tika

secrets = YAML.load(ERB.new(File.read(Rails.root.join('config', 'secrets.yml'))).result)
Expand Down

0 comments on commit 2fdaea7

Please sign in to comment.