Best Python code snippet using avocado_python
lvsetup.py
Source:lvsetup.py
...134 """135 Mounts and unmounts the filesystem on the logical volume.136 """137 lv_utils.lv_mount(self.vg_name, self.lv_name, self.mount_loc)138 lv_utils.lv_umount(self.vg_name, self.lv_name)139 @avocado.fail_on(lv_utils.LVException)140 def test(self):141 """142 A volume group with given name is created in the ramdisk. It then143 creates a logical volume, mounts and unmounts it.144 """145 self.create_lv()146 lv_utils.lv_mount(self.vg_name, self.lv_name, self.mount_loc,147 create_filesystem=self.fs_name)148 lv_utils.lv_umount(self.vg_name, self.lv_name)149 self.mount_unmount_lv()150 @avocado.fail_on(lv_utils.LVException)151 def test_vg_reactivate(self):152 """153 Deactivate, export, import and activate a volume group.154 """155 self.create_lv()156 lv_utils.lv_mount(self.vg_name, self.lv_name, self.mount_loc,157 create_filesystem=self.fs_name)158 lv_utils.lv_umount(self.vg_name, self.lv_name)159 lv_utils.vg_reactivate(self.vg_name, export=True)160 self.mount_unmount_lv()161 @avocado.fail_on(lv_utils.LVException)162 def test_lv_snapshot(self):163 """164 Takes a snapshot from the logical and merges snapshot with the165 logical volume.166 """167 self.create_lv()168 lv_utils.lv_mount(self.vg_name, self.lv_name, self.mount_loc,169 create_filesystem=self.fs_name)170 lv_utils.lv_umount(self.vg_name, self.lv_name)171 lv_utils.lv_take_snapshot(self.vg_name, self.lv_name,172 self.lv_snap_name,173 self.lv_snapshot_size)174 lv_utils.lv_revert(self.vg_name, self.lv_name, self.lv_snap_name)175 self.mount_unmount_lv()176 def tearDown(self):177 """178 Cleans up loop device.179 """180 self.delete_lv()181 if not self.disk:...
test_lv_utils.py
Source:test_lv_utils.py
...69 self.assertIn(vg_name, process.run("lvs --all",70 sudo=True).stdout_text)71 self.assertIn(lv_name, lv_utils.lv_list())72 lv_utils.lv_mount(vg_name, lv_name, mount_loc, "ext2")73 lv_utils.lv_umount(vg_name, lv_name)74 lv_utils.lv_remove(vg_name, lv_name)75 self.assertNotIn(lv_name, lv_utils.lv_list())76 # Cleanup ramdisk vgs77 lv_utils.vg_ramdisk_cleanup(ramdisk_filename, vg_ramdisk_dir,78 vg_name, loop_device)79 self.assertTrue(os.path.exists(ramdisk_basedir))80 self.assertFalse(glob.glob(os.path.join(ramdisk_basedir, "*")))81 except BaseException as details:82 try:83 process.run("mountpoint %s && umount %s"84 % (mount_loc, mount_loc), shell=True, sudo=True)85 except BaseException as details:86 print("Fail to unmount LV: %s" % details)87 try:...
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!!