Best Python code snippet using lisa_python
storagesuite.py
Source:storagesuite.py
...24 for data_disk in disk_list:25 fdisk.delete_partitions(data_disk)26 partition_disks.append(fdisk.make_partition(data_disk, format=False))27 return partition_disks28def _stop_raid(node: Node) -> None:29 mdadm = node.tools[Mdadm]30 mdadm.stop_raid()31def _make_mount_raid(node: Node, disk_list: List[str]) -> None:32 mdadm = node.tools[Mdadm]33 mdadm.create_raid(disk_list)34 mkfs = node.tools[Mkfs]35 mkfs.format_disk("/dev/md0", FileSystem.ext4)36 mount = node.tools[Mount]37 mount.mount("/dev/md0", "/data", options="nobarrier")38@TestSuiteMetadata(39 area="storage",40 category="functional",41 description="""42 This test suite is to validate storage function in Linux VM.43 """,44)45class StorageTest(TestSuite):46 @TestCaseMetadata(47 description="""48 This test case is to49 1. Make raid0 based on StandardHDDLRS disks.50 2. Mount raid0 with nobarrier options.51 """,52 priority=3,53 requirement=simple_requirement(54 disk=schema.DiskOptionSettings(55 disk_type=schema.DiskType.StandardHDDLRS,56 data_disk_iops=search_space.IntRange(min=500),57 data_disk_count=search_space.IntRange(min=64),58 ),59 ),60 )61 def verify_disk_with_nobarrier(self, node: Node, environment: Environment) -> None:62 disk = node.features[Disk]63 data_disks = disk.get_raw_data_disks()64 disk_count = len(data_disks)65 assert_that(disk_count).described_as(66 "At least 1 data disk for testing."67 ).is_greater_than(0)68 partition_disks = _format_disk(node, data_disks)69 _stop_raid(node)70 _make_mount_raid(node, partition_disks)71 def after_case(self, log: Logger, **kwargs: Any) -> None:72 node: Node = kwargs.pop("node")73 mount = node.tools[Mount]74 mount.umount("/dev/md0", "/data")...
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!!