Skip to content

Commit

Permalink
Merge pull request ManageIQ#11702 from NickLaMuro/remove_constant_war…
Browse files Browse the repository at this point in the history
…nings_from_specs

Remove Warnings regarding constants being already defined in tests
  • Loading branch information
chrisarcand committed Oct 5, 2016
2 parents 8dc4cff + 5f78962 commit 612ad2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
20 changes: 10 additions & 10 deletions spec/models/job_proxy_dispatcher_embedded_scan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
describe "dispatch embedded" do
include Spec::Support::JobProxyDispatcherHelper

NUM_VMS = 5
NUM_REPO_VMS = 0
NUM_HOSTS = 3
NUM_SERVERS = 3
NUM_STORAGES = 3
NUM_OF_VMS = 5
NUM_OF_REPO_VMS = 0
NUM_OF_HOSTS = 3
NUM_OF_SERVERS = 3
NUM_OF_STORAGES = 3

def assert_at_most_x_scan_jobs_per_y_resource(x_scans, y_resource)
vms_in_embedded_scanning = Job.where(["dispatch_status = ? AND state != ? AND agent_class = ? AND target_class = ?", "active", "finished", "MiqServer", "VmOrTemplate"]).select("target_id").collect(&:target_id).compact.uniq
Expand Down Expand Up @@ -40,7 +40,7 @@ def assert_at_most_x_scan_jobs_per_y_resource(x_scans, y_resource)
context "With a zone, server, ems, hosts, vmware vms" do
before(:each) do
server = EvmSpecHelper.local_miq_server(:is_master => true, :name => "test_server_main_server")
(NUM_SERVERS - 1).times do |i|
(NUM_OF_SERVERS - 1).times do |i|
FactoryGirl.create(:miq_server, :zone => server.zone, :name => "test_server_#{i}")
end

Expand All @@ -52,10 +52,10 @@ def assert_at_most_x_scan_jobs_per_y_resource(x_scans, y_resource)
allow_any_instance_of(Host).to receive_messages(:authentication_status_ok? => true)

@hosts, @proxies, @storages, @vms, @repo_vms = build_entities(
:hosts => NUM_HOSTS,
:storages => NUM_STORAGES,
:vms => NUM_VMS,
:repo_vms => NUM_REPO_VMS
:hosts => NUM_OF_HOSTS,
:storages => NUM_OF_STORAGES,
:vms => NUM_OF_VMS,
:repo_vms => NUM_OF_REPO_VMS
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,9 @@ def fetch_metadata(*_args)
end

context 'when create pod throws exception' do
CODE = 0
CLIENT_MESSAGE = 'error'.freeze
before(:each) do
allow_any_instance_of(MockKubeClient).to receive(:create_pod) do |_instance, *_args|
raise KubeException.new(CODE, CLIENT_MESSAGE, nil)
raise KubeException.new(0, 'error', nil)
end
end

Expand All @@ -207,11 +205,9 @@ def fetch_metadata(*_args)
end

context 'when getting the service account throws exception' do
CODE = 0
CLIENT_MESSAGE = 'error'.freeze
before(:each) do
allow_any_instance_of(MockKubeClient).to receive(:get_service_account) do |_instance, *_args|
raise KubeException.new(CODE, CLIENT_MESSAGE, nil)
raise KubeException.new(0, 'error', nil)
end
end

Expand Down

0 comments on commit 612ad2c

Please sign in to comment.