This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 164
[1LP][RFR] - Check STDOUT of provisioned ansible service #10289
Merged
mshriver
merged 1 commit into
ManageIQ:master
from
dgaikwad:test_ansible_playbook_stdout
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,13 @@ | |
from cfme.markers.env_markers.provider import ONE | ||
from cfme.markers.env_markers.provider import ONE_PER_TYPE | ||
from cfme.markers.env_markers.provider import SECOND | ||
from cfme.rest.gen_data import users as _users | ||
from cfme.roles import FEATURES_510 | ||
from cfme.roles import FEATURES_511 | ||
from cfme.services.myservice import MyService | ||
from cfme.services.service_catalogs import ServiceCatalogs | ||
from cfme.tests.integration.test_cfme_auth import retrieve_group | ||
from cfme.utils.appliance import ViaSSUI | ||
from cfme.utils.appliance.implementations.ui import navigate_to | ||
from cfme.utils.auth import auth_user_data | ||
from cfme.utils.blockers import BZ | ||
|
@@ -29,6 +32,7 @@ | |
from cfme.utils.update import update | ||
from cfme.utils.version import LOWEST | ||
from cfme.utils.version import VersionPicker | ||
from cfme.utils.wait import wait_for | ||
|
||
|
||
pytestmark = [ | ||
|
@@ -242,6 +246,25 @@ def tenant_custom_role(appliance, request, provider): | |
tenant_role.delete_if_exists() | ||
|
||
|
||
@pytest.fixture() | ||
def user_catalog(appliance, request, ansible_catalog_item): | ||
user, user_data = _users(request, appliance, group="EvmGroup-user_self_service") | ||
|
||
user_inst = appliance.collections.users.instantiate( | ||
name=user[0].name, | ||
credential=Credential(principal=user_data[0]["userid"], secret=user_data[0]["password"]), | ||
) | ||
ansible_catalog_item.set_ownership("Administrator", "EvmGroup-user_self_service") | ||
|
||
ansible_catalog = appliance.collections.catalogs.create( | ||
mshriver marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fauxfactory.gen_alphanumeric(), | ||
description="my ansible catalog", | ||
items=[ansible_catalog_item.name], | ||
) | ||
|
||
yield user_inst, ansible_catalog | ||
ansible_catalog.delete_if_exists() | ||
|
||
# User test cases | ||
@pytest.mark.sauce | ||
@pytest.mark.tier(2) | ||
|
@@ -2985,9 +3008,11 @@ def test_chargeback_report(): | |
|
||
@pytest.mark.customer_scenario | ||
@pytest.mark.tier(2) | ||
@pytest.mark.meta(coverage=[1836125]) | ||
def test_ansible_playbook_stdout(): | ||
""" Test standard output of ansible playbook of particular user | ||
@pytest.mark.meta(automates=[1836125]) | ||
def test_ansible_playbook_stdout( | ||
appliance, ansible_catalog_item, ansible_service_request, user_catalog, request | ||
): | ||
""" Test standard output of ansible playbook service using particular user | ||
Bugzilla: | ||
1836125 | ||
Polarion: | ||
|
@@ -3009,7 +3034,7 @@ def test_ansible_playbook_stdout(): | |
5. add service to shopping card | ||
6. order service | ||
7. log in main UI using newly created user | ||
8. navigate Services->My Servcies>Service> | ||
8. navigate Services->My Services>Service> | ||
9. Under "Active catalog" click on ordered service | ||
10. check stdout of service | ||
expectedResults: | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. There are fixtures to provide for and cleanup both of these instances. |
||
ansible_service = MyService(appliance, ansible_catalog_item.name) | ||
|
||
@request.addfinalizer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
def _finalize(): | ||
if ansible_service_request.exists(): | ||
ansible_service_request.remove_request() | ||
if ansible_service.exists: | ||
ansible_service.delete() | ||
|
||
with user: | ||
with appliance.context.use(ViaSSUI): | ||
appliance.server.login(user) | ||
service_catalog.add_to_shopping_cart() | ||
service_catalog.order() | ||
|
||
with user: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried putting everything under
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No because context is different. |
||
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): | ||
ansible_service_request.wait_for_request() | ||
view = navigate_to(ansible_service, "Details") | ||
view.provisioning_tab.click() | ||
assert view.provisioning.standart_output.is_displayed | ||
wait_for(lambda: view.provisioning.standart_output.text != "Loading...", timeout=30) | ||
assert "Hello World" in view.provisioning.standart_output.text |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.