Skip to content

Commit

Permalink
Merge pull request #4669 from ZitaNemeckova/fix_zone_related_failures
Browse files Browse the repository at this point in the history
Use existing Zone not 'default' for MiqServer.my_zone or in request

(cherry picked from commit 248d491)
  • Loading branch information
himdel authored and simaishi committed Oct 10, 2018
1 parent 08f9878 commit 52cd014
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
9 changes: 6 additions & 3 deletions spec/controllers/application_controller/ci_processing_spec.rb
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) }

before do
EvmSpecHelper.local_miq_server
login_as FactoryGirl.create(:user, :features => "everything")
Expand Down Expand Up @@ -670,14 +673,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 @@ -746,6 +747,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 @@ -810,7 +814,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
4 changes: 3 additions & 1 deletion spec/controllers/application_controller/performance_spec.rb
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 @@ -92,7 +92,7 @@
"name" => "foo_ec2",
"emstype" => "ec2",
"provider_region" => "ap-southeast-1",
"zone" => "default",
"zone" => zone.name,
"default_userid" => "foo",
"default_password" => "[FILTERED]",
}
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 @@ -43,7 +46,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
2 changes: 1 addition & 1 deletion spec/views/shared/views/ems_common/_show.html.haml_spec.rb
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

0 comments on commit 52cd014

Please sign in to comment.