Best Python code snippet using lisa_python
provisioning.py
Source:provisioning.py  
...203        is_restart: bool = True,204    ) -> None:205        if not node.is_remote:206            raise SkippedException(f"smoke test: {case_name} cannot run on local node.")207        is_ready, tcp_error_code = wait_tcp_port_ready(208            node.public_address, node.public_port, log=log, timeout=self.TIME_OUT209        )210        if not is_ready:211            serial_console = node.features[SerialConsole]212            serial_console.check_panic(213                saved_path=log_path, stage="bootup", force_run=True214            )215            raise TcpConnectionException(216                node.public_address,217                node.public_port,218                tcp_error_code,219                "no panic found in serial log during bootup",220            )221        try:222            timer = create_timer()223            log.info(f"SSH port 22 is opened, connecting and rebooting '{node.name}'")224            # In this step, the underlying shell will connect to SSH port.225            # If successful, the node will be reboot.226            # If failed, It distinguishes TCP and SSH errors by error messages.227            if reboot_in_platform:228                start_stop = node.features[StartStop]229                if is_restart:230                    start_stop.restart(wait=wait)231                else:232                    start_stop.stop(wait=wait)233                    start_stop.start(wait=wait)234                is_ready, tcp_error_code = wait_tcp_port_ready(235                    node.public_address,236                    node.public_port,237                    log=log,238                    timeout=self.PLATFORM_TIME_OUT,239                )240                if not is_ready:241                    serial_console = node.features[SerialConsole]242                    serial_console.check_panic(243                        saved_path=log_path, stage="reboot", force_run=True244                    )245                    raise TcpConnectionException(246                        node.public_address,247                        node.public_port,248                        tcp_error_code,...common.py
Source:common.py  
...40    is_ready = True41    timeout = 90042    timer = create_timer()43    while timeout > timer.elapsed(False):44        is_ready, _ = wait_tcp_port_ready(45            node.public_address,46            node.public_port,47            log=log,48            timeout=10,49        )50        if not is_ready:51            break52    if is_ready:53        raise LisaException("VM still can be accessed after hibernation")54    startstop.start()55    entry_after_hibernation = hibernation_setup_tool.check_entry()56    exit_after_hibernation = hibernation_setup_tool.check_exit()57    received_after_hibernation = hibernation_setup_tool.check_received()58    uevent_after_hibernation = hibernation_setup_tool.check_uevent()...boot.py
Source:boot.py  
...53        result.assert_exit_code()54        # 3. Reboot VM, check kernel version is debug type.55        reboot_tool = node.tools[Reboot]56        reboot_tool.reboot_and_check_panic(log_path)57        is_ready, tcp_error_code = wait_tcp_port_ready(58            node.public_address, node.public_port, log=log59        )60        if is_ready:61            uname = node.tools[Uname]62            kernel_version = uname.get_linux_information(63                force_run=True64            ).kernel_version_raw65            assert_that(66                kernel_version, "Kernel version is not debug type after reboot."67            ).contains("debug")68        else:69            raise TcpConnectionException(70                node.public_address,71                node.public_port,...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!!
