Best Python code snippet using lisa_python
ch_tests.py
Source:ch_tests.py  
...38        if not isinstance(node.os, (CBLMariner, Ubuntu)):39            raise SkippedException(40                f"Cloud Hypervisor tests are not implemented in LISA for {node.os.name}"41            )42        self._ensure_virtualization_enabled(node)43    @TestCaseMetadata(44        description="""45            Runs cloud-hypervisor integration tests.46        """,47        priority=3,48        requirement=node_requirement(49            node=schema.NodeSpace(50                core_count=search_space.IntRange(min=16),51                memory_mb=search_space.IntRange(min=16 * 1024),52            ),53        ),54    )55    def verify_cloud_hypervisor_integration_tests(56        self,57        log: Logger,58        node: Node,59        environment: Environment,60        log_path: Path,61        result: TestResult,62    ) -> None:63        hypervisor = self._get_hypervisor_param(node)64        node.tools[CloudHypervisorTests].run_tests(65            result, environment, "integration", hypervisor66        )67    @TestCaseMetadata(68        description="""69            Runs cloud-hypervisor live migration tests.70        """,71        priority=3,72        requirement=node_requirement(73            node=schema.NodeSpace(74                core_count=search_space.IntRange(min=16),75                memory_mb=search_space.IntRange(min=16 * 1024),76            ),77        ),78    )79    def verify_cloud_hypervisor_live_migration_tests(80        self,81        log: Logger,82        node: Node,83        environment: Environment,84        log_path: Path,85        result: TestResult,86    ) -> None:87        hypervisor = self._get_hypervisor_param(node)88        node.tools[CloudHypervisorTests].run_tests(89            result, environment, "integration-live-migration", hypervisor90        )91    @TestCaseMetadata(92        description="""93            Runs cloud-hypervisor performance metrics tests.94        """,95        priority=3,96    )97    def verify_cloud_hypervisor_performance_metrics_tests(98        self,99        log: Logger,100        node: Node,101        environment: Environment,102        log_path: Path,103        result: TestResult,104    ) -> None:105        hypervisor = self._get_hypervisor_param(node)106        node.tools[CloudHypervisorTests].run_metrics_tests(107            result, environment, hypervisor, log_path108        )109    def _ensure_virtualization_enabled(self, node: Node) -> None:110        virtualization_enabled = node.tools[Lscpu].is_virtualization_enabled()111        mshv_exists = node.tools[Ls].path_exists(path="/dev/mshv", sudo=True)112        if not virtualization_enabled and not mshv_exists:113            raise SkippedException("Virtualization is not enabled in hardware")114    def _get_hypervisor_param(self, node: Node) -> str:115        mshv_exists = node.tools[Ls].path_exists(path="/dev/mshv", sudo=True)116        if mshv_exists:117            return "mshv"...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
