From 95a537bd2c142c8724a5a55b4d1ab68c191a7fae Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Mon, 17 Sep 2018 10:02:13 -0400 Subject: [PATCH] Fix specs failing on a missing zone --- spec/factories/ext_management_system.rb | 8 ++++++++ .../container_manager/container_template_spec.rb | 6 +----- .../container_manager/refresher_inventory_object_spec.rb | 3 +-- .../openshift/container_manager/refresher_spec.rb | 3 +-- .../targeted_refresh/targeted_refresh_spec.rb | 3 +-- 5 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 spec/factories/ext_management_system.rb diff --git a/spec/factories/ext_management_system.rb b/spec/factories/ext_management_system.rb new file mode 100644 index 00000000..352b1967 --- /dev/null +++ b/spec/factories/ext_management_system.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :ems_openshift_with_zone, :parent => :ems_openshift do + zone do + _guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone + zone + end + end +end diff --git a/spec/models/manageiq/providers/openshift/container_manager/container_template_spec.rb b/spec/models/manageiq/providers/openshift/container_manager/container_template_spec.rb index d2ad4be4..73ceb735 100644 --- a/spec/models/manageiq/providers/openshift/container_manager/container_template_spec.rb +++ b/spec/models/manageiq/providers/openshift/container_manager/container_template_spec.rb @@ -3,7 +3,7 @@ hostname = 'host.example.com' token = 'theToken' FactoryGirl.create( - :ems_openshift, + :ems_openshift_with_zone, :name => 'OpenShiftProvider', :connection_configurations => [{:endpoint => {:role => :default, :hostname => hostname, @@ -20,10 +20,6 @@ ) end - before(:each) do - allow(MiqServer).to receive(:my_zone).and_return("default") - end - it "instantiate a template with parameters and object labels" do param = FactoryGirl.create(:container_template_parameter, :name => 'VAR', diff --git a/spec/models/manageiq/providers/openshift/container_manager/refresher_inventory_object_spec.rb b/spec/models/manageiq/providers/openshift/container_manager/refresher_inventory_object_spec.rb index c8fdd2a6..746f83fc 100644 --- a/spec/models/manageiq/providers/openshift/container_manager/refresher_inventory_object_spec.rb +++ b/spec/models/manageiq/providers/openshift/container_manager/refresher_inventory_object_spec.rb @@ -5,13 +5,12 @@ let(:images_managed_by_openshift_count) { 32 } # only images from /oapi/v1/images before(:each) do - allow(MiqServer).to receive(:my_zone).and_return("default") # env vars for easier VCR recording, see test_objects_record.sh hostname = ENV["OPENSHIFT_MASTER_HOST"] || "host.example.com" token = ENV["OPENSHIFT_MANAGEMENT_ADMIN_TOKEN"] || "theToken" @ems = FactoryGirl.create( - :ems_openshift, + :ems_openshift_with_zone, :name => "OpenShiftProvider", :connection_configurations => [{:endpoint => {:role => :default, :hostname => hostname, diff --git a/spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb b/spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb index f97439a0..d6b32775 100644 --- a/spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb +++ b/spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb @@ -5,13 +5,12 @@ let(:images_managed_by_openshift_count) { 32 } # only images from /oapi/v1/images before(:each) do - allow(MiqServer).to receive(:my_zone).and_return("default") # env vars for easier VCR recording, see test_objects_record.sh hostname = ENV["OPENSHIFT_MASTER_HOST"] || "host.example.com" token = ENV["OPENSHIFT_MANAGEMENT_ADMIN_TOKEN"] || "theToken" @ems = FactoryGirl.create( - :ems_openshift, + :ems_openshift_with_zone, :name => "OpenShiftProvider", :connection_configurations => [{:endpoint => {:role => :default, :hostname => hostname, diff --git a/spec/models/manageiq/providers/openshift/container_manager/targeted_refresh/targeted_refresh_spec.rb b/spec/models/manageiq/providers/openshift/container_manager/targeted_refresh/targeted_refresh_spec.rb index 823f4006..315f9d88 100644 --- a/spec/models/manageiq/providers/openshift/container_manager/targeted_refresh/targeted_refresh_spec.rb +++ b/spec/models/manageiq/providers/openshift/container_manager/targeted_refresh/targeted_refresh_spec.rb @@ -1,13 +1,12 @@ # instantiated at the end shared_examples "openshift refresher VCR targeted refresh tests" do before(:each) do - allow(MiqServer).to receive(:my_zone).and_return("default") hostname = 'host.example.com' token = 'theToken' hawkular_hostname = 'host.example.com' @ems = FactoryGirl.create( - :ems_openshift, + :ems_openshift_with_zone, :name => 'OpenshiftProvider', :connection_configurations => [{:endpoint => {:role => :default, :hostname => hostname,