def original_instance(request, original_method, original_domain, original_class): instance = Instance( name=fauxfactory.gen_alphanumeric(), values={ "meth5": { "value": original_method.name } }, cls=original_class, ) instance.create() request.addfinalizer(lambda: instance.delete() if instance.exists() else None) return instance
def original_instance(request, original_method, original_domain): instance = Instance(name=fauxfactory.gen_alphanumeric(), values={"meth5": { "value": original_method.name }}, cls=Class(name="Request", namespace=Namespace(name="System", parent=original_domain), setup_schema=[ Class.SchemaField(name="meth5", type_="Method") ])) instance.create() request.addfinalizer(lambda: instance.delete() if instance.exists() else None) return instance
def original_instance(request, original_method, original_domain): instance = Instance( name=fauxfactory.gen_alphanumeric(), values={ "meth5": { "value": original_method.name } }, cls=Class( name="Request", namespace=Namespace( name="System", parent=original_domain ), setup_schema=[Class.SchemaField(name="meth5", type_="Method")] ) ) instance.create() request.addfinalizer(lambda: instance.delete() if instance.exists() else None) return instance
def original_instance(request, original_method): if not Domain.default.is_enabled: with update(Domain.default): Domain.default.enabled = True instance = Instance( name=generate_random_string(), values={ "meth5": { "value": original_method.name } }, cls=Class( name="Request", namespace=Namespace( name="System", parent=Domain.default ) ) ) instance.create() request.addfinalizer(lambda: instance.delete() if instance.exists() else None) return instance
def test_vmware_vimapi_hotadd_disk( request, testing_group, provider_crud, provider_mgmt, testing_vm, domain, namespace, cls): """ Tests hot adding a disk to vmware vm Metadata: test_flag: hotdisk, provision """ # Instance that calls the method and is accessible from the button if current_version() < "5.3": rel = "/Integration/VimApi/VMware_HotAdd_Disk" else: rel = "/Integration/VMware/VimApi/VMware_HotAdd_Disk" instance = Instance( name="VMware_HotAdd_Disk", values={ "rel5": rel, }, cls=cls ) if not instance.exists(): request.addfinalizer(lambda: instance.delete() if instance.exists() else None) instance.create() # Dialog to put the disk capacity return element_data = { 'ele_label': "Disk size", 'ele_name': "size", 'ele_desc': "Disk size", 'choose_type': "Text Box", 'default_text_box': "Default text" } dialog = ServiceDialog( label=fauxfactory.gen_alphanumeric(), description=fauxfactory.gen_alphanumeric(), submit=True, tab_label=fauxfactory.gen_alphanumeric(), tab_desc=fauxfactory.gen_alphanumeric(), box_label=fauxfactory.gen_alphanumeric(), box_desc=fauxfactory.gen_alphanumeric(), ) dialog.create(element_data) request.addfinalizer(lambda: dialog.delete()) # Button that will invoke the dialog and action button_name = fauxfactory.gen_alphanumeric() button = Button(group=testing_group, text=button_name, hover=button_name, dialog=dialog, system="Request", request="VMware_HotAdd_Disk") request.addfinalizer(button.delete_if_exists) button.create() # Now do the funny stuff def _get_disk_count(): return int(testing_vm.get_detail( properties=("Datastore Allocation Summary", "Number of Disks")).strip()) original_disk_count = _get_disk_count() toolbar.select(testing_group.text, button.text) fill(Input("size"), "1") pytest.sel.click(submit) flash.assert_no_errors() wait_for(lambda: original_disk_count + 1 == _get_disk_count(), num_sec=180, delay=5)
def test_vmware_vimapi_hotadd_disk( request, testing_group, provider, testing_vm, domain, namespace, cls): """ Tests hot adding a disk to vmware vm. This test exercises the ``VMware_HotAdd_Disk`` method, located either in ``/Integration/VimApi/`` (<5.3) or ``/Integration/VMware/VimApi`` (5.3 and up). Steps: * It creates an instance in ``System/Request`` that can be accessible from eg. a button. * Then it creates a service dialog that contains a field with the desired disk size, the text field name should be ``size`` * Then it creates a button, that refers to the ``VMware_HotAdd_Disk`` in ``Request``. The button shall belong in the VM and instance button group. * After the button is created, it goes to a VM's summary page, clicks the button, enters the size of the disk and submits the dialog. * The test waits until the number of disks is raised. Metadata: test_flag: hotdisk, provision """ # Instance that calls the method and is accessible from the button if current_version() < "5.3": rel = "/Integration/VimApi/VMware_HotAdd_Disk" else: rel = "/Integration/VMware/VimApi/VMware_HotAdd_Disk" instance = Instance( name="VMware_HotAdd_Disk", values={ "rel5": rel, }, cls=cls ) if not instance.exists(): request.addfinalizer(lambda: instance.delete() if instance.exists() else None) instance.create() # Dialog to put the disk capacity return element_data = { 'ele_label': "Disk size", 'ele_name': "size", 'ele_desc': "Disk size", 'choose_type': "Text Box", 'default_text_box': "Default text" } dialog = ServiceDialog( label=fauxfactory.gen_alphanumeric(), description=fauxfactory.gen_alphanumeric(), submit=True, tab_label=fauxfactory.gen_alphanumeric(), tab_desc=fauxfactory.gen_alphanumeric(), box_label=fauxfactory.gen_alphanumeric(), box_desc=fauxfactory.gen_alphanumeric(), ) dialog.create(element_data) request.addfinalizer(lambda: dialog.delete()) # Button that will invoke the dialog and action button_name = fauxfactory.gen_alphanumeric() button = Button(group=testing_group, text=button_name, hover=button_name, dialog=dialog, system="Request", request="VMware_HotAdd_Disk") request.addfinalizer(button.delete_if_exists) button.create() # Now do the funny stuff def _get_disk_count(): return int(testing_vm.get_detail( properties=("Datastore Allocation Summary", "Number of Disks")).strip()) original_disk_count = _get_disk_count() toolbar.select(testing_group.text, button.text) fill(Input("size"), "1") pytest.sel.click(submit) flash.assert_no_errors() wait_for(lambda: original_disk_count + 1 == _get_disk_count(), num_sec=180, delay=5)
def test_vmware_vimapi_hotadd_disk(request, testing_group, provider, testing_vm, domain, namespace, cls): """ Tests hot adding a disk to vmware vm. This test exercises the ``VMware_HotAdd_Disk`` method, located either in ``/Integration/VimApi/`` (<5.3) or ``/Integration/VMware/VimApi`` (5.3 and up). Steps: * It creates an instance in ``System/Request`` that can be accessible from eg. a button. * Then it creates a service dialog that contains a field with the desired disk size, the text field name should be ``size`` * Then it creates a button, that refers to the ``VMware_HotAdd_Disk`` in ``Request``. The button shall belong in the VM and instance button group. * After the button is created, it goes to a VM's summary page, clicks the button, enters the size of the disk and submits the dialog. * The test waits until the number of disks is raised. Metadata: test_flag: hotdisk, provision """ # Instance that calls the method and is accessible from the button if current_version() < "5.3": rel = "/Integration/VimApi/VMware_HotAdd_Disk" else: rel = "/Integration/VMware/VimApi/VMware_HotAdd_Disk" instance = Instance(name="VMware_HotAdd_Disk", values={ "rel5": rel, }, cls=cls) if not instance.exists(): request.addfinalizer(lambda: instance.delete() if instance.exists() else None) instance.create() # Dialog to put the disk capacity return element_data = { 'ele_label': "Disk size", 'ele_name': "size", 'ele_desc': "Disk size", 'choose_type': "Text Box", 'default_text_box': "Default text" } dialog = ServiceDialog( label=fauxfactory.gen_alphanumeric(), description=fauxfactory.gen_alphanumeric(), submit=True, tab_label=fauxfactory.gen_alphanumeric(), tab_desc=fauxfactory.gen_alphanumeric(), box_label=fauxfactory.gen_alphanumeric(), box_desc=fauxfactory.gen_alphanumeric(), ) dialog.create(element_data) request.addfinalizer(lambda: dialog.delete()) # Button that will invoke the dialog and action button_name = fauxfactory.gen_alphanumeric() button = Button(group=testing_group, text=button_name, hover=button_name, dialog=dialog, system="Request", request="VMware_HotAdd_Disk") request.addfinalizer(button.delete_if_exists) button.create() # Now do the funny stuff def _get_disk_count(): return int( testing_vm.get_detail(properties=("Datastore Allocation Summary", "Number of Disks")).strip()) original_disk_count = _get_disk_count() toolbar.select(testing_group.text, button.text) fill(Input("size"), "1") pytest.sel.click(submit) flash.assert_no_errors() wait_for(lambda: original_disk_count + 1 == _get_disk_count(), num_sec=180, delay=5)