Skip to content

Commit

Permalink
Merge pull request #649 from bugsnag/fix-ruby-2-0-tests
Browse files Browse the repository at this point in the history
Fix Que & Mailman test fixtures on Ruby 2.0
  • Loading branch information
imjoehaines authored Jan 5, 2021
2 parents 3e01793 + 560de4a commit 188e889
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,6 @@ steps:
RUBY_TEST_VERSION: '2.0'
concurrency: 4
concurrency_group: 'ruby/integrations-maze-runner-tests'
soft_fail:
- exit_status: "*"

- label: ':postbox: Mailman Ruby 2.1 tests'
timeout_in_minutes: 30
Expand Down Expand Up @@ -823,8 +821,6 @@ steps:
RUBY_TEST_VERSION: '2.0'
concurrency: 4
concurrency_group: 'ruby/integrations-maze-runner-tests'
soft_fail:
- exit_status: "*"

- label: ':key: Que Ruby 2.1 tests'
timeout_in_minutes: 30
Expand Down
3 changes: 3 additions & 0 deletions features/fixtures/mailman/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ gem 'rb-inotify', '0.9.8'
gem 'maildir', '~> 2.1.0'
gem 'activesupport', '~> 3.2'
gem 'rack', '~> 1.6.11'

# Install a compatible FFI version on Ruby <2.3
gem 'ffi', '< 1.13.0' if RUBY_VERSION < '2.3.0'
4 changes: 3 additions & 1 deletion features/fixtures/que/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ gem "bugsnag", path: "/bugsnag"
gem "que", "~> 0.14.3"

gem "pg", RUBY_VERSION < "2.2.0" ? "0.21.0" : "> 0.21.0"

gem "activerecord", RUBY_VERSION < "2.2.0" ? "4.2.11" : "> 4.2.11"

# Install a compatible Minitest version on Ruby <2.3
gem 'minitest', '5.11.3' if RUBY_VERSION < '2.3.0'
18 changes: 18 additions & 0 deletions features/fixtures/que/app/app.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'pg'
require 'que'
require 'socket'
require 'bugsnag'
require 'active_record'

Expand All @@ -10,6 +11,23 @@
config.endpoint = ENV['BUGSNAG_ENDPOINT']
end

postgres_ready = false
attempts = 0
MAX_ATTEMPTS = 10

until postgres_ready || attempts >= MAX_ATTEMPTS
begin
Timeout::timeout(5) { TCPSocket.new('postgres', 5432).close }

postgres_ready = true
rescue Exception
attempts += 1
sleep 1
end
end

raise 'postgres was not ready in time!' unless postgres_ready

ActiveRecord::Base.establish_connection(
adapter: 'postgresql',
database: 'postgres',
Expand Down

0 comments on commit 188e889

Please sign in to comment.