Skip to content

Commit

Permalink
Use EvmSpecHelper.local_miq_server with a real zone
Browse files Browse the repository at this point in the history
Stubbing MiqServer.my_zone to return a dummy string was affecting the zone
with which events were added to MiqQueue, which broke now that MiqQueue
requires a real zone (ManageIQ/manageiq#17987).
  • Loading branch information
cben committed Oct 31, 2018
1 parent a6ee167 commit db9bdff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
@node = nil

before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

hostname = 'capture.context.com'
token = 'theToken'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::HawkularClient do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

hostname = 'hawkular.example.com'
token = 'the_token'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::HawkularLegacyCaptureContext do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

hostname = 'capture.context.com'
token = 'theToken'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@record = :none
# @record = :new_episodes

allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

master_hostname = 'master.example.com'
hostname = 'prometheus.example.com'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::PrometheusClient do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

hostname = 'prometheus.example.com'
token = 'good_token'
@ems = FactoryGirl.create(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# instantiated at the end, for both classical and graph refresh
shared_examples "kubernetes refresher VCR tests" do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

auth = AuthToken.new(:name => "test", :auth_key => "valid-token")
@ems = FactoryGirl.create(:ems_kubernetes, :hostname => "10.35.0.169",
:ipaddress => "10.35.0.169", :port => 6443,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 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")
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

hostname = 'host.example.com'
token = 'theToken'
hawkular_hostname = 'host.example.com'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@
end

it "Deletes the monitoring manager when container manager is removed the prometheus_alerts endpoint" do
EvmSpecHelper.local_miq_server(:zone => Zone.seed)

ems = FactoryGirl.create(
:ems_kubernetes,
:endpoints => [
Expand All @@ -243,7 +245,6 @@
expect(ems.monitoring_manager).not_to be_nil
expect(ems.monitoring_manager.parent_manager).to eq(ems)

allow(MiqServer).to receive(:my_zone).and_return("default")
ems.endpoints = [FactoryGirl.build(:endpoint, :role => 'default', :hostname => 'host3')]
queue_item = MiqQueue.find_by(:method_name => 'destroy')
expect(queue_item).not_to be_nil
Expand Down

0 comments on commit db9bdff

Please sign in to comment.