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

Fix Manage policies and Check compliance buttons for Container Images and others #4206

Conversation

hstastna
Copy link

@hstastna hstastna commented Jun 25, 2018

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


What:
Fix Manage policies button for Container Images which was "not yet implemented" even if this functionality is implemented and working if not accessing Container Images through Contaier provider's summary page but directly (Compute > Containers > Container Images).
Fix the same problem also for Container Replicators, Container Pods, Container Nodes.
Fix the same "Button not yet implemented" problem for Container Replicators, Pods, Nodes and Images also for Check Compliance of Last Known Configuration button.

Steps to reproduce:

  1. Go to Compute > Containers > Providers
  2. Choose some provider, display its summary screen
  3. Under Relationships, click on Container Images
  4. Choose some Container Image(s) (check the appropriate checkbox(es))
  5. Under Policy (toolbar), click on Manage policies
    => nothing happens, just "Button not yet implemented" flash message is displayed!

Details:
Calling assign_policies method for managing policies was simply missing in EmsCommon module, in button method. This did not work for some other nested lists displayed through Containers provider's summary page. If we go directly to Compute > Containers > Container Images/Nodes/Pods/Replicators, all the buttons work well.

Before:
Managing policies of selected Container Image:
images_before
Checking Compliance of Last Known Configuration of selected Container Image:
(the same picture as above)

After:
Managing policies of selected Container Image:
images_after
Checking Compliance of Last Known Configuration of selected Container Image:
images2_after

@hstastna
Copy link
Author

@miq-bot add_label bug, gaprindashvili/yes

@hstastna hstastna changed the title [WIP] Fix Manage policies button for Container Images and others [WIP] Fix Manage policies and Check compliance button for Container Images and others Jun 25, 2018
@hstastna hstastna changed the title [WIP] Fix Manage policies and Check compliance button for Container Images and others [WIP] Fix Manage policies and Check compliance buttons for Container Images and others Jun 25, 2018
@hstastna hstastna force-pushed the Manage_policies_button_not_yet_implemented_Container_Images branch 5 times, most recently from 99b1e89 to eb527c8 Compare June 26, 2018 12:15
Hilda Stastna added 2 commits June 28, 2018 11:41
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1530259

Add missing assign_policies method calling to button method to
make managing policies work for Container Images, Replicators etc.
@hstastna hstastna force-pushed the Manage_policies_button_not_yet_implemented_Container_Images branch from 007ab31 to d257fb5 Compare June 28, 2018 10:09
@hstastna hstastna changed the title [WIP] Fix Manage policies and Check compliance buttons for Container Images and others Fix Manage policies and Check compliance buttons for Container Images and others Jun 28, 2018
@miq-bot miq-bot removed the wip label Jun 28, 2018
@hstastna hstastna force-pushed the Manage_policies_button_not_yet_implemented_Container_Images branch from d257fb5 to 7879ab1 Compare June 28, 2018 12:49
@hstastna
Copy link
Author

hstastna commented Jun 28, 2018

@martinpovolny @mzazrivec Could you, please, review? Thanks!

@hstastna
Copy link
Author

@skateman Could you, please, review my specs? Thank you! ;)

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specs are beautiful, just small changes 😉

@@ -202,8 +202,8 @@ def test_setting_few_fields
end
end

context "#button" do
before(:each) do
describe "#button" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 😍 😍

context "updates provider with new token" do
before :each do
before do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 😍 😍

@@ -126,9 +126,9 @@ def test_creating(emstype)
end
end

context "#update" do
describe "#update" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 😍 😍

context "#button" do
before(:each) do
describe "#button" do
before do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 😍 😍

'container_replicator' => 'Container Replicators',
'container_node' => 'Container Nodes',
'container_group' => 'Container Pods'
}.each do |display_s, items|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might not need the hash values, just use an array and then call humanize.pluralize on each item.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But.. what about Container Pods?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need it in the testing, or just in the describe/context/it strings?

Copy link
Author

@hstastna hstastna Jun 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I removed the hash values and replaced them by an array of four items, I don't know how to set the string for context block properly and nicely (to see there for example 'tagging selected Container Pods' and not 'tagging selected Container Groups'). It's only for this there - for info what is being tested (context).

I consider this solution as the easiest and the most readable (at least for now). If something went wrong in some of the specs, we can easily recognize, what went wrong: we will not need to figure out that container_group is related to Container Pods because it's already there. And I need all of the contexts there to set params[:pressed] properly for each situation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

let(:provider) { ManageIQ::Providers::ContainerManager.new }

before do
allow(controller).to receive(:javascript_redirect).and_return(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need the and_return here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check it once again, thank you very much, David!

@hstastna hstastna force-pushed the Manage_policies_button_not_yet_implemented_Container_Images branch from b00c996 to 7339c81 Compare June 29, 2018 12:35
Add tests for the buttons for nested lists of Container Images/Nodes/Pods/Replicators.
@hstastna hstastna force-pushed the Manage_policies_button_not_yet_implemented_Container_Images branch from 7339c81 to e81fdf3 Compare June 29, 2018 12:37
@miq-bot
Copy link
Member

miq-bot commented Jun 29, 2018

Checked commits hstastna/manageiq-ui-classic@2c9ccc8~...e81fdf3 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@hstastna
Copy link
Author

@skateman @martinpovolny Any update about this? Could this be merged or any other things which I should add/change? Thank you! ;)

@skateman
Copy link
Member

@hstastna I'll take a look after lunch

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Seal of Approval

@mzazrivec mzazrivec added this to the Sprint 90 Ending Jul 16, 2018 milestone Jul 11, 2018
@mzazrivec mzazrivec merged commit 9279890 into ManageIQ:master Jul 11, 2018
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.

4 participants