Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Que & Mailman test fixtures on Ruby 2.0 #649

Merged
merged 5 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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