jeudi 1 septembre 2016

Need I create a mock logical volume to test calling lvremove on it

I'm currently editing a python script to call lvremove on a logical volume. My question is; can I create a mock logical volume in python for the purpose of a unit test or should I just treat it as a regular directory. The reason is to test the call to lvrmove - my code is as follows:

#check if lvm exists
    if os.path.isfile(lvm_lv_name)
        #then remove it
        lvremove -vf lvm_lv_name

        if os.path.isfile(lvm_lv_name)
            self.log.error("Removal of logical volume ",lvm_lv_name," was not successful")
        else:
            self.log.info("Logical volume",lvm_lv_name," successfully removed")
    else:
        self.log.info("Logical volume ",lvm_lv_name," could not be found")

Aucun commentaire:

Enregistrer un commentaire