Skip to content

Commit

Permalink
Partial backport of ManageIQ#289 from agrare/fix_metrics_capture_spec…
Browse files Browse the repository at this point in the history
…_failing_on_missing_zone

Fix MetricsCapture and Refresher specs failing due to a missing zone

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
Ladas authored and cben committed Nov 1, 2018
1 parent a87ef37 commit c72c393
Show file tree
Hide file tree
Showing 10 changed files with 439 additions and 17 deletions.
8 changes: 8 additions & 0 deletions spec/factories/ext_management_system.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FactoryGirl.define do
factory :ems_kubernetes_with_zone, :parent => :ems_kubernetes do
zone do
_guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone
zone
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
@node = nil

before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
hostname = 'capture.context.com'
token = 'theToken'

@ems = FactoryGirl.create(
:ems_kubernetes,
:ems_kubernetes_with_zone,
:name => 'KubernetesProvider',
:connection_configurations => [{:endpoint => {:role => :default,
:hostname => hostname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::HawkularClient do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
hostname = 'hawkular.example.com'
token = 'the_token'

@ems = FactoryGirl.create(
:ems_kubernetes,
:ems_kubernetes_with_zone,
:name => 'KubernetesProvider',
:connection_configurations => [{:endpoint => {:role => :default,
:hostname => hostname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::HawkularLegacyCaptureContext do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
hostname = 'capture.context.com'
token = 'theToken'

@ems = FactoryGirl.create(
:ems_kubernetes,
:ems_kubernetes_with_zone,
:name => 'KubernetesProvider',
:connection_configurations => [{:endpoint => {:role => :default,
:hostname => hostname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
@record = :none
# @record = :new_episodes

allow(MiqServer).to receive(:my_zone).and_return("default")

master_hostname = 'master.example.com'
hostname = 'prometheus.example.com'
token = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtYW5hZ2VtZW50LWluZnJhIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im1hbmFnZW1lbnQtYWRtaW4tdG9rZW4tZnJyeDgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoibWFuYWdlbWVudC1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjRhODY5NDczLWQ1ZGQtMTFlNy1iNjhlLTAwMWE0YTE2MjZiZCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDptYW5hZ2VtZW50LWluZnJhOm1hbmFnZW1lbnQtYWRtaW4ifQ.UhGy45pjWTak0NznD1v2rQtbf-XYis_5_ZKqVL0o7_4NFc69hsZZ4i_pSl2Pb4qsyNhWyZRY0JpKmBDz8CXIiZTb92laqrg_QQO4qMxo1nn2dHq_8nsMfdMAzR_dDzbUAlyPjhLMqUU9CecWzTodZ_PxLEfjZpMw8qIVAtca5fl5xgK1TbvnBdbnD_wK57PphadAZ1MCUdgzNgrs58WC59R1dv0lCL15UEXxamowLDZy1zWOG-WiHxFz5wN5iN7KCkPMnABOLoQ4k53kg-4sZzwqCPziUqyWm0mer2TwLzhqkuztzJnQ9AQBtt1kWvFKmPfGDUZ91bfGNfKeyd1gFw'

@ems = FactoryGirl.create(
:ems_kubernetes,
:ems_kubernetes_with_zone,
:name => 'KubernetesProvider',
:connection_configurations => [{:endpoint => {:role => :default,
:hostname => master_hostname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
describe ManageIQ::Providers::Kubernetes::ContainerManager::MetricsCapture::PrometheusClient do
before(:each) do
allow(MiqServer).to receive(:my_zone).and_return("default")
hostname = 'prometheus.example.com'
token = 'good_token'
@ems = FactoryGirl.create(
:ems_kubernetes,
:ems_kubernetes_with_zone,
:name => 'KubernetesProvider',
:connection_configurations => [{:endpoint => {:role => :default,
:hostname => hostname,
Expand Down
Loading

0 comments on commit c72c393

Please sign in to comment.