-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zone to q_options in call_automate. #18
Conversation
spec/miq_ae_event_spec.rb
Outdated
|
||
it "has tenant" do | ||
it "raise_evm_event, deliver_queue, with zone" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinaafitz can we use a shared example for these 2 tests and just change the zones
b4020f6
to
96be424
Compare
spec/miq_ae_event_spec.rb
Outdated
@@ -80,7 +101,7 @@ | |||
it "has tenant" do | |||
args = {:user_id => admin.id, :miq_group_id => vm_group.id, :tenant_id => vm_group.tenant.id} | |||
expect(MiqAeEngine).to receive(:deliver_queue).with(hash_including(args), anything) | |||
|
|||
expect(MiqServer).to receive(:my_zone).and_return('default') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinaafitz
Can we have something like this
before { allow(MiqServer).to receive_messages(:my_zone => "default") }
then we dont have to change every line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkanoor As discussed, will refactor this test in a separate PR.
96be424
to
db48545
Compare
@@ -121,6 +121,7 @@ def self.call_automate(obj, attrs, instance_name, options = {}) | |||
raise "A user is needed to raise #{instance_name} to automate. [#{obj.class.name}] id:[#{obj.id}]" unless user | |||
|
|||
q_options = { | |||
:zone => Zone.determine_queue_zone(options), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinaafitz This is already called during MiqQueue.put
? Is this really needed?
db48545
to
03d0263
Compare
@@ -125,6 +125,7 @@ def self.call_automate(obj, attrs, instance_name, options = {}) | |||
:priority => MiqQueue::HIGH_PRIORITY, | |||
:task_id => nil # Clear task_id to allow running synchronously under current worker process | |||
} | |||
q_options[:zone] = options[:zone] if options.keys.include?(:zone) && !options[:zone].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q_options[:zone] = options[:zone] if options[:zone].present?
03d0263
to
d189964
Compare
19ddbd6
to
009400b
Compare
spec/miq_ae_event_spec.rb
Outdated
context "with group owned VM" do | ||
let(:vm_group) { FactoryGirl.create(:miq_group, :tenant => FactoryGirl.create(:tenant)) } | ||
|
||
it "has tenant" do | ||
args = {:user_id => admin.id, :miq_group_id => vm_group.id, :tenant_id => vm_group.tenant.id} | ||
expect(MiqAeEngine).to receive(:deliver_queue).with(hash_including(args), anything) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinaafitz No sure if you intentionally remove this line but it seems random with the other changes in this PR and now makes this test inconsistent with (most) of the remaining tests that separate the expect().to receive
and the following method call. I tend to prefer this separation between testing logic and the code being run for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmcculloug Added blank line back, thanks for catching it.
Separate Manageiq change to pass zone_name required. https://bugzilla.redhat.com/show_bug.cgi?id=1447625
009400b
to
c3cf50f
Compare
Checked commit tinaafitz@c3cf50f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Fine backport (to manageiq repo) details:
|
Euwe backport (to manageiq repo) details:
|
Separate Manageiq change to pass zone_name required.
https://bugzilla.redhat.com/show_bug.cgi?id=1447625
Related PR ManageIQ/manageiq#15026