Intersting, we are working on this:
https://github.com/oVirt/vdsm/blob/master/tests/storagefakelib.py

But it fakes vdsm module, not the underlying lvm commands.

בתאריך 22 בדצמ׳ 2015 6:50 אחה״צ,‏ "Fabian Deutsch" <fdeutsch@redhat.com> כתב:
On Tue, Dec 22, 2015 at 5:35 PM, Nir Soffer <nsoffer@redhat.com> wrote:
> What is fakelvm?
>
> We are interested in this for storage tests.

It's actually a small class which mimics  teh LVM behavior.

It was written from scratch - and is still rough. But the idea works out.
It is intended to be used with python-mock.

The module is here:
https://gerrit.ovirt.org/gitweb?p=imgbased.git;a=blob;f=tests/fakelvm.py;hb=HEAD

One consumer of this is:
https://gerrit.ovirt.org/gitweb?p=imgbased.git;a=blob;f=tests/testSanity.py;hb=HEAD

The biggest gap is to document it and get the API straight.

I.e. currently I tried to follow the following pattern:

lv = LV()  # To instantiate a LV
lv = VG().create(…)  # To create a mocked VG

- fabian

> בתאריך 22 בדצמ׳ 2015 6:24 אחה״צ,‏ "Fabian Deutsch" <fdeutsch@redhat.com>
> כתב:
>>
>> Hey,
>>
>> imgbased [1] is the layer management component in Node Next, leveraging
>> lvm.
>> In the last days I've added unittests for this component.
>>
>> After Ryan ramped up the jobs, I spent some time to fix the unit tests.
>> Previously imgbased was tested inside VMs to run the unit tests.
>> Now I moved to a fake LVM which is modeling the real LVm behavior, to
>> run the unit tests.
>>
>> This is _much_ quicker, and much easier to handle.
>>
>> To try it yourself, just clone [1] and run
>>
>> $ make check
>>
>> - fabian
>>
>>
>> --
>> [1] https://gerrit.ovirt.org/gitweb?p=imgbased.git
>>
>> --
>> Fabian Deutsch <fdeutsch@redhat.com>
>> RHEV Hypervisor
>> Red Hat
>> _______________________________________________
>> Devel mailing list
>> Devel@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/devel



--
Fabian Deutsch <fdeutsch@redhat.com>
RHEV Hypervisor
Red Hat