-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] New Test: Testing quota simultaneous #9740
Conversation
022a9be
to
3c24000
Compare
259468c
to
0b6b9b5
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.
Two questions about re-login, and another about using REST to create tenant, group, and users, LGTM otherwise.
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() | ||
) |
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 using REST to create tenants?
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.
- 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 |
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'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}) |
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 using f-string here?
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.
Already used.
tenant_quota_data.update({f"{field}_cb": True, field: value}) | ||
new_project.set_quota(**tenant_quota_data) | ||
yield | ||
appliance.server.login_admin() |
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 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( |
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 using REST?
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.
same as above
""" | ||
with new_user_project: | ||
with appliance.context.use(context): | ||
appliance.server.login(new_user_project) |
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 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.
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.
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()
0b6b9b5
to
ff116d6
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.
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") |
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.
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( |
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 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) |
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 no need of instantiating provision request. Its already instantiate by order
method.
- Testing quota simultaneous Signed-off-by: Ganesh Hubale <[email protected]>
ff116d6
to
1a411f7
Compare
I detected some fixture changes in commit 1a411f7 The local fixture
The local fixture
The local fixture
The local fixture
The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
Signed-off-by: Ganesh Hubale [email protected]
Purpose or Intent
PRT Run
{{ pytest: cfme/tests/infrastructure/test_tenant_quota.py -k 'test_simultaneous_tenant_quota' --use-template-cache -qsvv --use-provider=rhv43 }}