Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/openstack/tests/functional/baremetal/__pycache__/test_baremetal_allocation.cpython-39.pyc
Ðазад
a u�h � @ sV d dl Z d dlmZ d dlmZ G dd� dej�ZG dd� de�ZG dd � d e�ZdS ) � N)� exceptions)�basec s$ e Zd Z� fdd�Zdd� Z� ZS )�Basec s, t t| ��� dt�d� | _| �� | _d S )Nzbaremetal-%di )�superr �setUp�random� randrange�resource_class�_create_available_node�node��self�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/openstack/tests/functional/baremetal/test_baremetal_allocation.pyr s z Base.setUpc s^ �j �jd�� �jjj� ddd� �jjj� ddd� �jj�� d� ��� �fdd�� � S ) N�r ZmanageT)�waitZprovidez power offc s �j jj� jd d�S )N)Zinstance_id)�conn� baremetalZupdate_node�idr �r r r r �<lambda>% s �z-Base._create_available_node.<locals>.<lambda>)Zcreate_noder r r Zset_node_provision_stateZset_node_power_stateZ addCleanupr r r r r s ���zBase._create_available_node)�__name__� __module__�__qualname__r r � __classcell__r r r r r s r c @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� ZdS ) �TestBareMetalAllocationz1.52c C s | j | jd�}| �d|j� | �|j� | �|j� | jj� |�}| �|j |j � | �d|j� | �| jj |j� | �|j� | jjj|j ddgd�}| �|j |j � | �|j� | jj� | jj �}| �|j |j� | jjj|dd� | �tj| jjj|j � d S ) Nr Z allocating�active�uuidZ node_uuid��fieldsF�Zignore_missing)�create_allocationr �assertEqual�state�assertIsNoneZnode_id� last_errorr r �wait_for_allocationr r �get_allocationZget_nodeZ allocation_id�delete_allocation�assertRaisesr �ResourceNotFound)r � allocationZloadedZwith_fieldsr r r r �!test_allocation_create_get_delete. s( ��z9TestBareMetalAllocation.test_allocation_create_get_deletec C s� | j | jd�}| j | jd d�}| jj�|� | jjj|dd� | jj�� }| �dd� |D �|j|jh� | jjjdd�}| �d d � |D �|jg� | jjj| jjd�}| �dd � |D �|jg� | jjj| jd d�}| �d d � |D �|jg� d S )Nr �-failT)Zignore_errorc S s h | ] }|j �qS r �r ��.0�pr r r � <setcomp>P � z?TestBareMetalAllocation.test_allocation_list.<locals>.<setcomp>r )r% c S s g | ] }|j �qS r r0 r1 r r r � <listcomp>T r5 z@TestBareMetalAllocation.test_allocation_list.<locals>.<listcomp>)r c S s g | ] }|j �qS r r0 r1 r r r r6 W r5 c S s g | ] }|j �qS r r0 r1 r r r r6 [ r5 ) r# r r r r( �allocationsr$ r r )r Zallocation1Zallocation2r7 r r r �test_allocation_listF s( �� ��z,TestBareMetalAllocation.test_allocation_listc C s^ | j | jd d�}| �tj| jjj|� | jj�|j �}| � d|j� | �| jd |j � d S )Nr/ r �error)r# r r+ r ZSDKExceptionr r r( r) r r$ r% ZassertInr'