def teardown_method(self):
        """Method to delete creates bps and apps during tests"""

        # Resetting context
        ContextObj = get_context()
        ContextObj.reset_configuration()

        # Resetting metadata object
        reset_metadata_obj()

        for bp_name in self.created_bp_list:
            LOG.info("Deleting Blueprint {}".format(bp_name))
            runner = CliRunner()
            result = runner.invoke(cli, ["delete", "bp", bp_name])
            assert result.exit_code == 0

        for app_name in self.created_app_list:
            LOG.info("Deleting App {}".format(app_name))
            self._wait_for_non_busy_state(app_name=app_name)
            runner = CliRunner()
            result = runner.invoke(cli, ["delete", "app", app_name])
            assert result.exit_code == 0

        self.created_bp_list = []
        self.created_app_list = []
Пример #2
0
    def setup_method(self):
        """Method to create project"""

        # Resetting context
        ContextObj = get_context()
        ContextObj.reset_configuration()

        # Resetting metadata object
        reset_metadata_obj()

        runner = CliRunner()
        self.dsl_project_name = "Test_DSL_Project_{}".format(str(uuid.uuid4()))
        result = runner.invoke(
            cli,
            [
                "create",
                "project",
                "--file={}".format(DSL_PROJECT_PATH),
                "--name={}".format(self.dsl_project_name),
                "--description='Test DSL Project to delete'",
            ],
        )
        if result.exit_code:
            cli_res_dict = {
                "Output": result.output,
                "Exception": str(result.exception)
            }
            LOG.debug("Cli Response: {}".format(
                json.dumps(cli_res_dict, indent=4, separators=(",", ": "))))
            LOG.debug("Traceback: \n{}".format("".join(
                traceback.format_tb(result.exc_info[2]))))
            pytest.fail("Project creation from python file failed")
Пример #3
0
    def teardown_method(self):
        """ "Reset the context changes"""

        # Resetting context
        ContextObj = get_context()
        ContextObj.reset_configuration()

        # Resetting metadata object
        reset_metadata_obj()
Пример #4
0
    def setup_method(self):
        """Method to instantiate to created_bp_list and reset context"""

        # Resetting context
        ContextObj = get_context()
        ContextObj.reset_configuration()

        # Resetting metadata object
        reset_metadata_obj()

        self.created_bp_list = []
Пример #5
0
    def teardown_method(self):
        """Method to delete project if not deleted during tests"""

        # Reset the context changes
        ContextObj = get_context()
        ContextObj.reset_configuration()

        if self.project_name and (not self.project_deleted):
            self._test_delete_project()

        # Resetting metadata object
        reset_metadata_obj()
Пример #6
0
    def setup_method(self):
        """Method to instantiate variable for projects to be deleted"""

        self.project_deleted = False
        self.project_name = None

        # Reset the context changes
        ContextObj = get_context()
        ContextObj.reset_configuration()

        # Resetting metadata object
        reset_metadata_obj()
Пример #7
0
    def teardown_method(self):
        """Method to delete creates bps and apps during tests"""

        for bp_name in self.created_bp_list:
            LOG.info("Deleting Blueprint {}".format(bp_name))
            runner = CliRunner()
            result = runner.invoke(cli, ["delete", "bp", bp_name])
            assert result.exit_code == 0

        self.created_bp_list = []

        # Resetting metadata object/context
        reset_metadata_obj()
Пример #8
0
def test_multivm_with_diff_bootconfig():
    """
    Tests in case of multi-vm blueprint, correct disk is set to bootable
    """

    # Ahv Helpers uses Metadata Context, It should the context(if any) defined in this file only
    get_metadata_payload(__file__)
    ContextObj = get_context()
    ContextObj.reset_configuration()

    spec = AhvBlueprint.get_dict()
    substrate_list = spec["substrate_definition_list"]

    # From AhvBlueprint class
    # substrate_list[0] = AhvVmSubstrate and substrate_list[1] = AhvVmSubstrate2

    # In AhvVmSubstrate -> MyAhvVm (vm_cls)
    # Check SCSI disk with device_index = 2 is bootable
    ahv_vm_substrate_spec = substrate_list[0]
    assert ahv_vm_substrate_spec["create_spec"]["resources"][
        "boot_config"] == {
            "boot_device": {
                "disk_address": {
                    "device_index": 2,
                    "adapter_type": "SCSI"
                }
            }
        }

    # In AhvVmSubstrate2 -> MyAhvVm2 (vm_cls)
    # Check PCI disk with device_index = 0 is bootable
    ahv_vm_substrate2_spec = substrate_list[1]
    assert ahv_vm_substrate2_spec["create_spec"]["resources"][
        "boot_config"] == {
            "boot_device": {
                "disk_address": {
                    "device_index": 0,
                    "adapter_type": "PCI"
                }
            }
        }

    # reset metadata obj
    reset_metadata_obj()
Пример #9
0
    def teardown_method(self):
        """Method to delete created project in setup method"""

        # Reset metadata context
        reset_metadata_obj()

        runner = CliRunner()
        result = runner.invoke(cli,
                               ["delete", "project", self.dsl_project_name])
        if result.exit_code:
            cli_res_dict = {
                "Output": result.output,
                "Exception": str(result.exception)
            }
            LOG.debug("Cli Response: {}".format(
                json.dumps(cli_res_dict, indent=4, separators=(",", ": "))))
            LOG.debug("Traceback: \n{}".format("".join(
                traceback.format_tb(result.exc_info[2]))))
            pytest.fail("Project deletion failed")