-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #553 from agrare/subclass_cinder_manager_openstack
Subclass CinderManagers under Openstack
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
db/migrate/20210118185402_subclass_cinder_manager_openstack.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class SubclassCinderManagerOpenstack < ActiveRecord::Migration[6.0] | ||
class ExtManagementSystem < ActiveRecord::Base | ||
self.inheritance_column = :_type_disabled | ||
end | ||
|
||
def up | ||
say_with_time("Subclass CinderManager under Openstack") do | ||
ExtManagementSystem.where(:type => "ManageIQ::Providers::StorageManager::CinderManager") | ||
.update_all(:type => "ManageIQ::Providers::Openstack::StorageManager::CinderManager") | ||
end | ||
end | ||
end |
23 changes: 23 additions & 0 deletions
23
spec/migrations/20210118185402_subclass_cinder_manager_openstack_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require_migration | ||
|
||
RSpec.describe SubclassCinderManagerOpenstack do | ||
let(:ems_stub) { migration_stub(:ExtManagementSystem) } | ||
|
||
migration_context :up do | ||
it "Updates the CinderManager :type" do | ||
ems = ems_stub.create!(:type => "ManageIQ::Providers::StorageManager::CinderManager") | ||
|
||
migrate | ||
|
||
expect(ems.reload.type).to eq("ManageIQ::Providers::Openstack::StorageManager::CinderManager") | ||
end | ||
|
||
it "Doesn't update other managers' types" do | ||
ems = ems_stub.create!(:type => "ManageIQ::Providers::Vmware::InfraManager") | ||
|
||
migrate | ||
|
||
expect(ems.reload.type).to eq("ManageIQ::Providers::Vmware::InfraManager") | ||
end | ||
end | ||
end |