Skip to content

Commit

Permalink
Remove all VMware MKS console-related records from SettingSchanges
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Feb 9, 2018
1 parent 40c5ced commit 64a26d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions db/migrate/20180130165200_drop_webmks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class DropWebmks < ActiveRecord::Migration[5.0]
class MiqServer < ActiveRecord::Base; end
class SettingsChange < ActiveRecord::Base; end

def up
say_with_time "Remove all VMware MKS console-related records from settings" do
SettingsChange.where(:key => '/server/remote_console_type', :value => 'MKS').delete_all
end
end
end
17 changes: 17 additions & 0 deletions spec/migrations/20180130165200_drop_webmks_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require_migration

describe DropWebmks do
let(:server_stub) { migration_stub(:MiqServer) }
let(:settings_stub) { migration_stub(:SettingsChange) }

migration_context :up do
let(:server) { server_stub.create }

it 'resets the remote_console_type to default' do
settings_stub.create(:resource_id => server.id, :resource_type => server.class, :key => '/server/remote_console_type', :value => 'MKS')
migrate

expect(settings_stub.where(:key => '/server/remote_console_type', :value => 'MKS').count).to be_zero
end
end
end

0 comments on commit 64a26d9

Please sign in to comment.