Skip to content

Commit

Permalink
Merge pull request #90 from eagletmt/rails61
Browse files Browse the repository at this point in the history
Update Rails to 6.1
  • Loading branch information
eagletmt authored Jan 6, 2022
2 parents 5100998 + 730c232 commit 15e8621
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.6
- 2.7
# TODO: Add 3.0 after upgrading Rails
- '2.6'
- '2.7'
- '3.0'
name: Run test with Ruby ${{ matrix.ruby }}
services:
mysql:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v2.x.x (xxxx-xx-xx)
### Changes
- Update Rails to 6.1
- Support Ruby 3.0

## v2.8.0 (2021-12-23)
### New features
- Pass `BARBEQUE_SENT_TIMESTAMP` variable to invoked jobs
Expand Down
4 changes: 2 additions & 2 deletions app/services/barbeque/sns_subscription_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def subscribe(sns_subscription)
update_sqs_policy!(sns_subscription)
true
rescue Aws::SNS::Errors::AuthorizationError
sns_subscription.errors[:topic_arn] << 'is not authorized'
sns_subscription.errors.add(:topic_arn, 'is not authorized')
false
rescue Aws::SNS::Errors::NotFound
sns_subscription.errors[:topic_arn] << 'is not found'
sns_subscription.errors.add(:topic_arn, 'is not found')
false
end
else
Expand Down
2 changes: 1 addition & 1 deletion barbeque.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.add_dependency "hamlit"
s.add_dependency "jquery-rails"
s.add_dependency "kaminari", ">= 1.2.1"
s.add_dependency "rails", "~> 5.2.0"
s.add_dependency "rails", "~> 6.1.4"
s.add_dependency "rinku"
s.add_dependency "sass-rails"
s.add_dependency "serverengine"
Expand Down
2 changes: 1 addition & 1 deletion lib/barbeque/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Barbeque
module Executor
def self.create
klass = const_get(Barbeque.config.executor, false)
klass.new(Barbeque.config.executor_options)
klass.new(**Barbeque.config.executor_options)
end
end
end
2 changes: 1 addition & 1 deletion lib/barbeque/executor/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Docker
class DockerCommandError < StandardError
end

def initialize(_options)
def initialize(**)
end

# @param [Barbeque::JobExecution] job_execution
Expand Down
2 changes: 1 addition & 1 deletion lib/barbeque/executor/hako.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HakoCommandError < StandardError
# @param [String] yaml_dir (deprecated: renamed to definition_dir)
def initialize(hako_dir:, hako_env: {}, yaml_dir: nil, definition_dir: nil, oneshot_notification_prefix:)
@hako_dir = hako_dir
@hako_env = hako_env
@hako_env = hako_env.stringify_keys
@definition_dir =
if definition_dir
definition_dir
Expand Down
2 changes: 1 addition & 1 deletion spec/barbeque/execution_poller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:executor) { double('Barbeque::Executor::Docker') }

before do
allow(Barbeque::Executor::Docker).to receive(:new).with({}).and_return(executor)
allow(Barbeque::Executor::Docker).to receive(:new).and_return(executor)
end

describe '#run' do
Expand Down
2 changes: 1 addition & 1 deletion spec/barbeque/executor/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'barbeque/executor/docker'

RSpec.describe Barbeque::Executor::Docker do
let(:executor) { described_class.new({}) }
let(:executor) { described_class.new }
let(:command) { ['rake', 'test'] }
let(:job_definition) { FactoryBot.create(:job_definition, command: ['rake', 'test']) }
let(:job_execution) { FactoryBot.create(:job_execution, job_definition: job_definition, status: :pending) }
Expand Down
14 changes: 10 additions & 4 deletions spec/barbeque/executor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
let(:barbeque_yml) { 'barbeque' }

it 'initializes a configured executor' do
expect(Barbeque::Executor::Docker).to receive(:new).with({})
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7.0')
# Ruby < 2.7 isn't ready for keyword arguments
expect(Barbeque::Executor::Docker).to receive(:new).with({})
else
expect(Barbeque::Executor::Docker).to receive(:new).with(no_args)
end
Barbeque::Executor.create
end
end
Expand All @@ -23,11 +28,12 @@
it 'initializes a configured executor with configured options' do
expect(Barbeque::Executor::Hako).to receive(:new).with(
hako_dir: '/home/k0kubun/hako_repo',
hako_env: { 'ACCESS_TOKEN' => 'token' },
hako_env: { ACCESS_TOKEN: 'token' },
yaml_dir: '/yamls',
oneshot_notification_prefix: 's3://barbeque/task_statuses?region=ap-northeast-1',
)
Barbeque::Executor.create
).and_call_original
hako = Barbeque::Executor.create
expect(hako.instance_variable_get(:@hako_env)).to eq({ 'ACCESS_TOKEN' => 'token' })
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/barbeque/message_handler/job_execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let(:executor) { double('Barbeque::Executor::Docker') }

before do
allow(Barbeque::Executor::Docker).to receive(:new).with({}).and_return(executor)
allow(Barbeque::Executor::Docker).to receive(:new).and_return(executor)
allow(Barbeque::ExecutionLog).to receive(:save_message)
allow(Barbeque::ExecutionLog).to receive(:save_stdout_and_stderr)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/barbeque/message_handler/job_retry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
before do
allow(Barbeque::ExecutionLog).to receive(:save_stdout_and_stderr)
allow(Barbeque::ExecutionLog).to receive(:load).with(execution: job_execution).and_return({ 'message' => message_body })
allow(Barbeque::Executor::Docker).to receive(:new).with({}).and_return(executor)
allow(Barbeque::Executor::Docker).to receive(:new).and_return(executor)
end

around do |example|
Expand Down
2 changes: 1 addition & 1 deletion spec/barbeque/retry_poller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:executor) { double('Barbeque::Executor::Docker') }

before do
allow(Barbeque::Executor::Docker).to receive(:new).with({}).and_return(executor)
allow(Barbeque::Executor::Docker).to receive(:new).and_return(executor)
end

describe '#run' do
Expand Down

0 comments on commit 15e8621

Please sign in to comment.