Skip to content

Commit

Permalink
Missing ServiceOrderV2V and ServiceTemplateTransformationPlan subclasses
Browse files Browse the repository at this point in the history
Update the Rails version to 6.0.
Change the support table_list and documented tables for the removed tables.
  • Loading branch information
jrafanie committed Oct 22, 2021
1 parent afba496 commit 2d0539a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
15 changes: 13 additions & 2 deletions db/migrate/20211022193626_remove_migration_feature.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class RemoveMigrationFeature < ActiveRecord::Migration[5.2]
class RemoveMigrationFeature < ActiveRecord::Migration[6.0]
class ServiceTemplate < ActiveRecord::Base
self.inheritance_column = :_type_disabled
end
Expand All @@ -15,6 +15,10 @@ class Job < ActiveRecord::Base
self.inheritance_column = :_type_disabled
end

class ServiceOrder < ActiveRecord::Base
self.inheritance_column = :_type_disabled
end

class Vm < ActiveRecord::Base
self.inheritance_column = :_type_disabled
end
Expand All @@ -27,13 +31,20 @@ class CustomAttribute < ActiveRecord::Base; end
class Tag < ActiveRecord::Base; end
class Tagging < ActiveRecord::Base; end

TRANSFORMATION_PLAN_CLASSES = %w[
ServiceTemplateTransformationPlan
ManageIQ::Providers::Openstack::CloudManager::ServiceTemplateTransformationPlan
ManageIQ::Providers::Redhat::InfraManager::ServiceTemplateTransformationPlan
]

def up
# These classes inherit from core classes, so we don't drop the tables.
# Instead we remove the records.
ServiceTemplate.where(:type => "ServiceTemplateTransformationPlan").delete_all
ServiceTemplate.where(:type => TRANSFORMATION_PLAN_CLASSES).delete_all
MiqRequest.where(:type => "ServiceTemplateTransformationPlanRequest").delete_all
MiqRequestTask.where(:type => "ServiceTemplateTransformationPlanTask").delete_all
Job.where(:type => "InfraConversionJob").delete_all
ServiceOrder.where(:type => "ServiceOrderV2V").delete_all

# Conversion hosts can be either a RHV host or VM, or an OpenStack VM
# We need to clean the resources, i.e. remove tags and custom attributes
Expand Down
2 changes: 1 addition & 1 deletion spec/automated_review/column_documentation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe "Column documentation" do
# Documented tables
%w[conversion_hosts miq_tasks].each do |table_name|
%w[miq_tasks].each do |table_name|
it "#{table_name} columns are documented" do
klass = Class.new(ActiveRecord::Base) do
self.table_name = table_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
let(:miq_request) { migration_stub(:MiqRequest) }
let(:miq_request_task) { migration_stub(:MiqRequestTask) }
let(:job) { migration_stub(:Job) }
let(:service_order) { migration_stub(:ServiceOrder) }
let(:conversion_host) { migration_stub(:ConversionHost) }
let(:tag) { migration_stub(:Tag) }
let(:tagging) { migration_stub(:Tagging) }
Expand All @@ -16,6 +17,8 @@
it "cleans the database and removes the tables" do
service_template.create!(:type => "ServiceTemplate")
service_template.create!(:type => "ServiceTemplateTransformationPlan")
service_template.create!(:type => "ManageIQ::Providers::Openstack::CloudManager::ServiceTemplateTransformationPlan")
service_template.create!(:type => "ManageIQ::Providers::Redhat::InfraManager::ServiceTemplateTransformationPlan")

miq_request.create!(:type => "MiqRequest")
miq_request.create!(:type => "ServiceTemplateTransformationPlanRequest")
Expand All @@ -26,6 +29,9 @@
job.create!(:type => "Job")
job.create!(:type => "InfraConversionJob")

service_order.create!(:type => "ServiceOrder")
service_order.create!(:type => "ServiceOrderV2V")

tag_1 = tag.create!(:name => "/managed/v2v_transformation_host/false")
tag_2 = tag.create!(:name => "/managed/v2v_transformation_host/true")
tag_3 = tag.create!(:name => "/managed/v2v_transformation_method/vddk")
Expand Down Expand Up @@ -57,6 +63,9 @@
expect(job.count).to eq(1)
expect(job.first.type).to eq("Job")

expect(service_order.count).to eq(1)
expect(service_order.first.type).to eq("ServiceOrder")

expect(tag.count).to eq(1)
expect(tag.first.name).to eq("/managed/stub/dummy")

Expand Down
5 changes: 1 addition & 4 deletions spec/support/table_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ container_template_parameters
container_templates
container_volumes
containers
conversion_hosts
currencies
custom_attributes
custom_buttons
Expand Down Expand Up @@ -122,8 +121,8 @@ guest_devices
hardwares
host_aggregate_hosts
host_aggregates
host_initiators
host_initiator_groups
host_initiators
host_service_groups
host_storages
host_switches
Expand Down Expand Up @@ -326,8 +325,6 @@ tags
tenant_quotas
tenants
time_profiles
transformation_mapping_items
transformation_mappings
users
vim_performance_operating_ranges
vim_performance_states
Expand Down

0 comments on commit 2d0539a

Please sign in to comment.