Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR]Automated Service state test #9824

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions cfme/tests/services/test_myservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from cfme import test_requirements
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.services.myservice import MyService
from cfme.services.myservice.ui import MyServiceDetailView
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.utils import browser
from cfme.utils.appliance import ViaUI
from cfme.utils.appliance.implementations.ui import navigate_to
Expand Down Expand Up @@ -184,11 +186,11 @@ def test_retire_on_date_for_multiple_service():
pass


@pytest.mark.meta(coverage=[1678123])
@pytest.mark.manual
@pytest.mark.meta(automates=[1678123])
@pytest.mark.ignore_stream('5.10')
@pytest.mark.tier(2)
def test_service_state():
@pytest.mark.parametrize("check", ["provisioned", "un_provisioned"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor suggestion: please replace un_provisioned <==> unprovisioned

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, I'd say it's optional though

def test_service_state(request, appliance, provider, catalog_item, check):
"""
Bugzilla:
1678123
Expand All @@ -208,7 +210,28 @@ def test_service_state():
3.
4. Service State should be Provisioned or Failed
"""
pass
service_catalogs = ServiceCatalogs(appliance, catalog_item.catalog, catalog_item.name)
service = MyService(appliance, catalog_item.name)
service_request = service_catalogs.order()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use fixture 'order_service' that will order catalog_item and also delete service at the end.

https://github.com/ManageIQ/integration_tests/blob/master/cfme/fixtures/service_fixtures.py#L161

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sshveta we need to fail ordered service catalog item before successfully provisioned. so for that, we are removing provider while ordered catalog item is in progress hence we can not use fixture which provides successfully provision service catalog item.


@request.addfinalizer
def _finalize():
service.delete()

if check == "provisioned":
expected_state = "Provisioned"
service_request.wait_for_request(method="ui", num_sec=200 * 60, delay=120)
else:
expected_state = "Unprovisioned"
# Delete Provider while service is provisioning
provider.delete_rest()
provider.wait_for_delete()

view = navigate_to(service, "Details")
wait_for(lambda: view.entities.lifecycle.get_text_of("State") == expected_state,
fail_condition=0,
num_sec=300,
fail_func=view.browser.refresh)


@pytest.mark.meta(coverage=[1727443])
Expand Down