Skip to content
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

Merged
merged 1 commit into from
May 10, 2017

Conversation

tinaafitz
Copy link
Member

@tinaafitz tinaafitz commented May 8, 2017

Separate Manageiq change to pass zone_name required.

https://bugzilla.redhat.com/show_bug.cgi?id=1447625

Related PR ManageIQ/manageiq#15026

@tinaafitz tinaafitz changed the title Add zone to q_options in call_automate. [WIP] Add zone to q_options in call_automate. May 8, 2017
@miq-bot miq-bot added the wip label May 8, 2017
@gmcculloug gmcculloug requested a review from mkanoor May 8, 2017 19:16
@gmcculloug gmcculloug self-assigned this May 8, 2017

it "has tenant" do
it "raise_evm_event, deliver_queue, with zone" do
Copy link
Contributor

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

@@ -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')
Copy link
Contributor

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

Copy link
Member Author

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.

@tinaafitz tinaafitz changed the title [WIP] Add zone to q_options in call_automate. Add zone to q_options in call_automate. May 8, 2017
@miq-bot miq-bot removed the wip label May 8, 2017
@@ -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),
Copy link
Member

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?

@@ -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?
Copy link
Member

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?

@tinaafitz tinaafitz force-pushed the add_zone_to_qoptions branch 2 times, most recently from 19ddbd6 to 009400b Compare May 9, 2017 22:30
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)

Copy link
Member

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.

Copy link
Member Author

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.

@miq-bot
Copy link
Member

miq-bot commented May 10, 2017

Checked commit tinaafitz@c3cf50f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

@gmcculloug gmcculloug merged commit 0495c11 into ManageIQ:master May 10, 2017
@gmcculloug gmcculloug added this to the Sprint 61 Ending May 22, 2017 milestone May 10, 2017
@simaishi
Copy link
Contributor

simaishi commented May 10, 2017

Fine backport (to manageiq repo) details:

$ git log -1
commit 86c23029db18065a2ea5b27d00aac60fc170c518
Author: Greg McCullough <[email protected]>
Date:   Wed May 10 10:23:00 2017 -0400

    Merge pull request #18 from tinaafitz/add_zone_to_qoptions
    
    Add zone to q_options in call_automate.
    (cherry picked from commit 0495c11579d5751f91c6e6791c65cdd1db09ad88)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1449748

@simaishi
Copy link
Contributor

Euwe backport (to manageiq repo) details:

$ git log -1
commit 7051ce276be724232cd2d0b4e46b31e8e24f2ab1
Author: Greg McCullough <[email protected]>
Date:   Wed May 10 10:23:00 2017 -0400

    Merge pull request #18 from tinaafitz/add_zone_to_qoptions
    
    Add zone to q_options in call_automate.
    (cherry picked from commit 0495c11579d5751f91c6e6791c65cdd1db09ad88)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1449753

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants