-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] - Check STDOUT of provisioned ansible service #10289
[1LP][RFR] - Check STDOUT of provisioned ansible service #10289
Conversation
41bc916
to
d810b05
Compare
d810b05
to
7f93ef5
Compare
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.
This test is good but there are few things that could be made better.
|
||
@property | ||
def is_displayed(self): | ||
return self.form.select_an_owner.is_displayed and self.form.select_group.is_displayed |
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.
Optional - You might want to add other checks such as self.submit.is_displayed and self.cancel.is_enabled and self.reset.is_enabled
.
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.
Done
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.
Done, Can't add is_display
for reset
button before changing the state.
@@ -144,7 +144,7 @@ class provisioning(View): # noqa | |||
'normalize-space(.)="Plays"]]') | |||
details = SummaryTable(title='Details') | |||
credentials = SummaryTable(title='Credentials') | |||
standart_output = Text('.//div[@id="provisioning"]//pre') | |||
standart_output = Text('.//div[@id="provisioning"]/ansible-raw-stdout') |
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.
This doesn't break anything else, does it?
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.
At this point we're only supporting 5.11 and upstream with the master branch, so I'm not concerned with the potential for this to break the locator in older versions.
@@ -826,3 +827,26 @@ class EditTags(CFMENavigateStep): | |||
|
|||
def step(self, *args, **kwargs): | |||
self.prerequisite_view.policy.item_select('Edit Tags') | |||
|
|||
|
|||
class SetOwnershipView(ServicesCatalogView): |
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.
It would be nice if you could move this view with other views in the top part of this file.
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.
Done
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.
Done
@pytest.fixture() | ||
def custom_user(appliance): | ||
group = appliance.collections.groups.instantiate("EvmGroup-user_self_service") | ||
user = appliance.collections.users.create( |
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.
Why don't you use REST API to create the user? It would make this thing faster.
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.
Done
view = navigate_to(ansible_catalog_item, "SetOwnership") | ||
view.form.select_an_owner.fill("Administrator") | ||
view.form.select_group.fill(group.description) | ||
view.submit.click() |
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.
Thoughts on adding a method called set_ownership
to BaseCatalogItem
?
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.
Done
fauxfactory.gen_alphanumeric(), | ||
description="my ansible catalog", | ||
items=[ansible_catalog_item.name], | ||
) |
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.
Everything until here seems like a part of the setup, thoughts on moving this to a fixture, maybe renaming custom_user and putting everything there?
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.
Done
|
||
with user: | ||
with appliance.context.use(ViaSSUI): | ||
appliance.server.login(user) |
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.
Since you're using with user
you probably don't need to manually login.
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.
I tried but it was not working without this login()
view = ssui_nav(service_catalog, "Details") | ||
view.add_to_shopping_cart.click() | ||
view = ssui_nav(service_catalog, "ShoppingCart") | ||
view.order.click() |
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.
I think you can directly do service_catalog.order()
to order it and since you're using the SSUI context, it will order it via SSUI.
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.
Done
if ansible_catalog.exists: | ||
ansible_catalog.delete() |
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.
if ansible_catalog.exists: | |
ansible_catalog.delete() | |
ansible_catalog.delete_if_exists() |
bd49003
to
18ec2db
Compare
@pytest.mark.meta(coverage=[1836125]) | ||
def test_ansible_playbook_stdout(): | ||
""" Test standard output of ansible playbook of particular user | ||
@pytest.mark.meta(automate=[1836125]) |
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.
typo: automates
ansible_service.delete() | ||
ansible_catalog.delete_if_exists() | ||
|
||
with user: |
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.
Have you tried putting everything under with user
block?
with user:
with appliance.context.use(ViaSSUI):
appliance.server.login(user)
...
...
error_message = (
"MIQ(Api::TasksController.api_error) Api::NotFoundError: Couldn't find MiqTask with"
)
with LogValidator(
"/var/www/miq/vmdb/log/api.log", failure_patterns=[error_message],
).waiting(timeout=120):
...
...
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.
No because context is different.
view = ssui_nav(service_catalog, "Details") | ||
view.add_to_shopping_cart.click() | ||
service_catalog.order() |
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.
You don't need to navigate to details page and click on shopping cart, you can just do service_catalog.order()
.
view = ssui_nav(service_catalog, "Details") | |
view.add_to_shopping_cart.click() | |
service_catalog.order() | |
service_catalog.order() |
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.
We have to explicitly add service in the catalog service_catalog.order()
don't add
@@ -242,6 +247,26 @@ def tenant_custom_role(appliance, request, provider): | |||
tenant_role.delete_if_exists() | |||
|
|||
|
|||
@pytest.fixture() | |||
def user_catalog(appliance, request, ansible_catalog_item): | |||
group = appliance.rest_api.collections.groups.get(description="EvmGroup-user_self_service") |
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.
Optional - You can just assign group description to a variable instead of instantiating the group since you're only using group description.
18ec2db
to
d5f695f
Compare
d5f695f
to
eba58b3
Compare
I detected some fixture changes in commit eba58b3 The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
Updated pytest options in description to include @dgaikwad I saw some failures in PRT after including that test, blocking verification of the widget behavior. Check out #10299, where I moved all ansible service requests to use the function scoped fixture. |
service_catalog = ServiceCatalogs(appliance, ansible_catalog, ansible_catalog_item.name) | ||
ansible_service = MyService(appliance, ansible_catalog_item.name) | ||
|
||
@request.addfinalizer |
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.
If you rebase this onto 10299, this finalizer will no longer be necessary.
@@ -3024,4 +3049,33 @@ def test_ansible_playbook_stdout(): | |||
9. | |||
10. able to see standard output | |||
""" | |||
pass | |||
user, ansible_catalog = user_catalog | |||
service_catalog = ServiceCatalogs(appliance, ansible_catalog, ansible_catalog_item.name) |
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.
There are fixtures to provide for and cleanup both of these instances.
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.
#10299 should follow this, I'll end up changing some things that you have here, but the test content and the new view is good!
test_appliance_console_logfile_config_reboot
moved test to manual only because need large effort to automate it.{{pytest: cfme/tests/configure/test_access_control.py::test_ansible_playbook_stdout cfme/tests/ansible/test_embedded_ansible_services.py::test_ansible_group_id_in_payload cfme/tests/ansible/test_embedded_ansible_services.py::test_service_ansible_playbook_pass_extra_vars --long-running -v}}