Skip to content

Commit

Permalink
NEP-10148 Enable application version constraint support on TenantWork…
Browse files Browse the repository at this point in the history
…er (#28)
  • Loading branch information
andrba authored Jul 22, 2020
1 parent f20e018 commit 67748bf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [3.4.0] - 2020-07-21
## [3.5.0] - 2020-07-22
### Added
- Enable application version constraint support on `Patches::TenantWorker`

## [3.4.0] - 2020-07-22
### Added
- `Patches::TenantWorker` application version constraint forward compatibility

Expand Down
6 changes: 5 additions & 1 deletion lib/patches/tenant_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def perform
Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}")
tenants.each do |tenant|
if parallel?
Patches::TenantWorker.perform_async(tenant, path)
Patches::TenantWorker.perform_async(
tenant,
path,
application_version: Patches::Config.configuration.application_version
)
else
run(tenant, path)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/patches/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Patches
MAJOR = 3
MINOR = 4
MINOR = 5
PATCH = 0
VERSION = [MAJOR, MINOR, PATCH].compact.join(".").freeze
end
8 changes: 5 additions & 3 deletions spec/tenant_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ module Tenant

describe Patches::TenantRunner do
let(:runner) { double('Runner') }
let(:application_version) { 'd8f190c' }

before do
Sidekiq::Testing.fake!
allow(Patches).to receive(:default_path).and_return('')
allow(Patches::Config.configuration).to receive(:application_version) { application_version }
end

context 'with tenants' do
Expand All @@ -39,7 +41,7 @@ module Tenant

specify do
expect(subject.tenants).to eql(['test'])
expect(Patches::TenantWorker).to receive(:perform_async).with('test', nil).and_call_original
expect(Patches::TenantWorker).to receive(:perform_async).with('test', nil, application_version: application_version).and_call_original
expect { subject.perform }.to change(Patches::TenantWorker.jobs, :size).by(1)
end

Expand All @@ -48,8 +50,8 @@ module Tenant

specify do
expect(subject.tenants).to eql(['test', 'test2'])
expect(Patches::TenantWorker).to receive(:perform_async).with('test', nil).and_call_original
expect(Patches::TenantWorker).to receive(:perform_async).with('test2', nil).and_call_original
expect(Patches::TenantWorker).to receive(:perform_async).with('test', nil, application_version: application_version).and_call_original
expect(Patches::TenantWorker).to receive(:perform_async).with('test2', nil, application_version: application_version).and_call_original
expect { subject.perform }.to change(Patches::TenantWorker.jobs, :size).by(2)
end
end
Expand Down

0 comments on commit 67748bf

Please sign in to comment.