コード例 #1
0
 def test_no_horizontal_lock(self, cluster: Cluster, lock_action):
     """
     Test that no horizontal lock when cluster locked
     """
     second_cluster = cluster.prototype().cluster_create(name=random_string())
     _lock_obj(cluster, lock_action)
     is_free(second_cluster)
コード例 #2
0
def check_cluster_actions_roles_are_created_correctly(
    client: ADCMClient,
    cluster: Cluster,
    hidden_role_names: set,
    hidden_role_prefix: str,
):
    """
    Check that all cluster action roles have corresponding hidden roles,
    that roles are bonded to correct business role,
    and the business role is assigned to correct default RBAC roles.
    """
    cluster_proto = cluster.prototype()
    actions = cluster_proto.actions
    full_hidden_prefix = f'{hidden_role_prefix}{get_prototype_prefix_for_action_role(cluster_proto)}'
    with allure.step(
            'Check that "hidden" roles are created for each action in cluster'
    ):
        cluster_actions_role_names = get_actions_role_names(
            full_hidden_prefix, actions)
        is_superset_of(hidden_role_names, cluster_actions_role_names,
                       'Not all expected "hidden" roles were found')
    _, business = check_business_roles_children(client, cluster_proto, actions,
                                                cluster_actions_role_names)

    with allure.step(
            'Check that business roles are applied correctly to RBAC default roles'
    ):
        business_roles_ids = get_roles_ids_from_info(business)
        check_roles_are_added_to_rbac_roles(
            client,
            rbac_roles=(RbacRoles.ClusterAdministrator, ),
            children_roles_ids=business_roles_ids,
        )

    check_all_roles_have_category(cluster_proto.display_name, business)