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

[1LP][RFR] New Test: Testing quota simultaneous #9740

Merged
merged 3 commits into from
Jan 2, 2020

Conversation

ganeshhubale
Copy link
Member

Signed-off-by: Ganesh Hubale [email protected]

Purpose or Intent

  • Test multiple tenant quotas simultaneously

PRT Run

{{ pytest: cfme/tests/infrastructure/test_tenant_quota.py -k 'test_simultaneous_tenant_quota' --use-template-cache -qsvv --use-provider=rhv43 }}

@ganeshhubale ganeshhubale added the test-automation To be applied on PR's which are automating existing manual cases label Dec 9, 2019
@ganeshhubale ganeshhubale changed the title [WIP] New Test: Testing quota simultaneous [WIPTEST] New Test: Testing quota simultaneous Dec 11, 2019
@dajoRH dajoRH added WIP-testing and removed WIP labels Dec 11, 2019
@ganeshhubale ganeshhubale force-pushed the simult-quota branch 2 times, most recently from 259468c to 0b6b9b5 Compare December 26, 2019 12:16
@ganeshhubale ganeshhubale changed the title [WIPTEST] New Test: Testing quota simultaneous [RFR] New Test: Testing quota simultaneous Dec 26, 2019
Copy link
Contributor

@valaparthvi valaparthvi left a comment

Choose a reason for hiding this comment

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

Two questions about re-login, and another about using REST to create tenant, group, and users, LGTM otherwise.

Comment on lines +593 to +597
tenant = appliance.collections.tenants.create(
name=fauxfactory.gen_alphanumeric(18, start="test_parent_"),
description=fauxfactory.gen_alphanumeric(18, start="parent_desc_"),
parent=appliance.collections.tenants.get_root_tenant()
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on using REST to create tenants?

Copy link
Member Author

Choose a reason for hiding this comment

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

@valaparthvi

  • Tenants are very important with respect to QUOTA related test cases. So it is always better to create them via UI. So we can confirm that there is no issue while creating tenants, child tenants or projects and it's child.
  • Hence I am keeping as it is for this as well as coming test cases of quota.

@pytest.fixture(scope='module')
def new_project(appliance, new_tenants):
"""This fixture create project under parent tenant1"""
tenant1, tenant2 = new_tenants
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're not going to use tenant2, you could just do just use _ instead.
tenant1, _ = new_tenants

field_value = request.param
tenant_quota_data = {}
for field, value in field_value:
tenant_quota_data.update({f"{field}_cb": True, field: value})
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on using f-string here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Already used.

tenant_quota_data.update({f"{field}_cb": True, field: value})
new_project.set_quota(**tenant_quota_data)
yield
appliance.server.login_admin()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to login? When you do new_project.set_quota(...), it would automatically login.

@pytest.fixture(scope="module")
def new_user_project(appliance, new_group_project):
"""This fixture creates new user which is assigned to new group and project"""
user = appliance.collections.users.create(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on using REST?

Copy link
Member Author

Choose a reason for hiding this comment

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

same as above

"""
with new_user_project:
with appliance.context.use(context):
appliance.server.login(new_user_project)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you login again with the new_user_project? As far as I know, when you do with new_user_project it automatically logs in with the new_user_project and performs the actions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I also tried what you are suggesting but this is the user(not having admin rights). Logs in to SSUI portal and order the catalog item. So this needs explicitly login using appliance.server.login()

@valaparthvi valaparthvi changed the title [RFR] New Test: Testing quota simultaneous [1LP][RFR] New Test: Testing quota simultaneous Jan 1, 2020
Copy link
Contributor

@digitronik digitronik left a comment

Choose a reason for hiding this comment

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

Nice PR. Some comments please have a glance.

raise RBACOperationBlocked("Configuration action '{}' is not enabled".format(
edit_group_txt))
if not view.toolbar.configuration.is_enabled:
raise RBACOperationBlocked(f"Configuration action 'Edit this Group' is not enabled")
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary use of f string.

def new_group_project(appliance, new_project):
"""This fixture creates new group and assigned by new project"""
role = appliance.collections.roles.instantiate(name="EvmRole-user_self_service")
user_role = role.copy(
Copy link
Contributor

Choose a reason for hiding this comment

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

we need teardown for copied role ^^

service_catalogs.order()
# nav to requests page to check quota validation
request_description = f'Provisioning Service [{catalog_item.name}] from [{catalog_item.name}]'
provision_request = appliance.collections.requests.instantiate(request_description)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think no need of instantiating provision request. Its already instantiate by order method.

@digitronik digitronik changed the title [1LP][RFR] New Test: Testing quota simultaneous [1LP][WIP] New Test: Testing quota simultaneous Jan 2, 2020
@dajoRH dajoRH added the WIP label Jan 2, 2020
Ganesh Hubale added 2 commits January 2, 2020 13:05
    - Testing quota simultaneous

Signed-off-by: Ganesh Hubale <[email protected]>
@ganeshhubale ganeshhubale changed the title [1LP][WIP] New Test: Testing quota simultaneous [1LP][WIPTEST] New Test: Testing quota simultaneous Jan 2, 2020
@dajoRH dajoRH added WIP-testing and removed WIP labels Jan 2, 2020
@dajoRH
Copy link
Contributor

dajoRH commented Jan 2, 2020

I detected some fixture changes in commit 1a411f7

The local fixture new_tenants is used in the following files:

  • cfme/tests/infrastructure/test_tenant_quota.py
    • new_project

The local fixture new_project is used in the following files:

  • cfme/tests/infrastructure/test_tenant_quota.py
    • set_project_quota
    • new_group_project
    • test_simultaneous_tenant_quota

The local fixture set_project_quota is used in the following files:

  • cfme/tests/infrastructure/test_tenant_quota.py

The local fixture new_group_project is used in the following files:

  • cfme/tests/infrastructure/test_tenant_quota.py
    • new_user_project

The local fixture new_user_project is used in the following files:

  • cfme/tests/infrastructure/test_tenant_quota.py
    • test_simultaneous_tenant_quota

Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃

@ganeshhubale ganeshhubale changed the title [1LP][WIPTEST] New Test: Testing quota simultaneous [1LP][RFR] New Test: Testing quota simultaneous Jan 2, 2020
@dajoRH dajoRH removed the WIP-testing label Jan 2, 2020
@digitronik digitronik merged commit b1d8a8e into ManageIQ:master Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lint-ok test-automation To be applied on PR's which are automating existing manual cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants