Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use existing Zone not 'default' for MiqServer.my_zone or in request #4669

Merged
merged 1 commit into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
describe ApplicationController do
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Were we queueing things without a zone before this change?

Copy link
Contributor

@himdel himdel Sep 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zone didn't exist, we would just use "default" before in the specs.. (without such a zone existing in the db)


before do
EvmSpecHelper.local_miq_server
login_as FactoryGirl.create(:user, :features => "everything")
Expand Down Expand Up @@ -744,14 +747,12 @@
context "#process_elements" do
it "shows passed in display name in flash message" do
pxe = FactoryGirl.create(:pxe_server)
allow(MiqServer).to receive(:my_zone).and_return("default")
controller.send(:process_elements, [pxe.id], PxeServer, 'synchronize_advertised_images_queue', 'Refresh Relationships')
expect(assigns(:flash_array).first[:message]).to include("Refresh Relationships successfully initiated")
end

it "shows task name in flash message when display name is not passed in" do
pxe = FactoryGirl.create(:pxe_server)
allow(MiqServer).to receive(:my_zone).and_return("default")
controller.send(:process_elements, [pxe.id], PxeServer, 'synchronize_advertised_images_queue')
expect(assigns(:flash_array).first[:message])
.to include("synchronize_advertised_images_queue successfully initiated")
Expand Down Expand Up @@ -820,6 +821,9 @@
end

describe HostController do
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }

context "#show_association" do
before(:each) do
stub_user(:features => :all)
Expand Down Expand Up @@ -883,7 +887,6 @@
@host1 = FactoryGirl.create(:host)
@host2 = FactoryGirl.create(:host)
allow(controller).to receive(:filter_ids_in_region).and_return([[@host1, @host2], nil])
allow(MiqServer).to receive(:my_zone).and_return("default")
end

it "initiates host destroy" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
describe ApplicationController do
context "#perf_planning_gen_data" do
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }

it "should not get nil error when submitting up Manual Input data" do
_enterprise = FactoryGirl.create(:miq_enterprise)
allow(MiqServer).to receive(:my_zone).and_return("default")
sb = {
:options => {
:target_typ => "EmsCluster",
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/ems_cloud_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"name" => "foo_ec2",
"emstype" => "ec2",
"provider_region" => "ap-southeast-1",
"zone" => "default",
"zone" => zone.name,
"default_userid" => "foo",
"default_password" => "[FILTERED]",
"default_url" => ""
Expand Down
3 changes: 2 additions & 1 deletion spec/controllers/mixins/actions/vm_actions/rename_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@

describe '#rename_save' do
let(:controller) { VmInfraController.new }
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }

before do
allow(MiqServer).to receive(:my_zone).and_return('default')
allow(controller).to receive(:session).and_return(:userid => 'admin')
controller.instance_variable_set(:@record, vm)
controller.instance_variable_set(:@edit, :new => {:name => 'new_vm_name'})
Expand Down
4 changes: 3 additions & 1 deletion spec/controllers/pxe_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
end

describe 'x_button' do
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }

before do
ApplicationController.handle_exceptions = true
end
Expand All @@ -42,7 +45,6 @@

it "Pressing Refresh button should show display name in the flash message" do
pxe = FactoryGirl.create(:pxe_server)
allow(MiqServer).to receive(:my_zone).and_return("default")
controller.instance_variable_set(:@_params, :id => pxe.id)
controller.instance_variable_set(:@sb,
:trees => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
TestSetup.new(:ems_openstack, EmsCloudHelper::TextualSummary),
TestSetup.new(:ems_vmware, EmsInfraHelper::TextualSummary),
].each do |setup|
let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
let(:zone) { FactoryGirl.create(:zone) }
let(:ems) { FactoryGirl.create(setup.ems_type, :hostname => '1.1.1.1', :zone => zone) }
let(:action) { 'index' }

before do
view.extend setup.helper
allow(MiqServer).to receive(:my_zone).and_return("default")
allow(controller).to receive(:controller_name).and_return("ems_cloud")
creds = {}
creds[:amqp] = {:userid => "amqp_user", :password => "amqp_password"}
Expand Down