[Kimchi-devel] Why do we use mockmodel?

Crístian Viana vianac at linux.vnet.ibm.com
Fri Oct 3 20:52:16 UTC 2014


On Sex, 2014-10-03 at 11:15 -0300, Aline Manera wrote:
> Hi Cristian,
> 
> Sorry about the time but let me clarify some things.
> The mockmodel exists to make the tests easier but also to allow user run 
> Kimchi without affecting it system (with --test option).
> It permits user uses Kimchi without the fear of breaking something on 
> system.
> 
> But I completely agree with you that what we have today is not the best 
> solution for it.
> Because that I proposed a mockmodel refactor for the next release.
> 
> ----
>     The mockmodel was designed to provide a way to user tests Kimchi 
> without affecting the system (by "kimchid --test") and also to make the 
> tests easier to do.
>     But in fact, we have a bunch of code that completely differs from 
> the real model, so the developer needs to do 2 kinds of implementations 
> while developing a new feature.
>     My proposal is simplify that by using Model() with "test:///default" 
> URI.
>     This configuration does not affect the system in real and also can 
> provide us a way to test the new feature in a closer scenario to the 
> real one: by connecting to libvirt and doing the operations.
>     As you may know "test:///default" driver has some limitations that 
> prevents some operations, for example, screenshots.
>     To solve it we could only override what is not supported by this 
> driver and create a simpler mockmodel.
> 
>     Example:
>     class MockModel(Model):
>         super(Model, self).__init__("test:///default")
> 
>         def vmscreenshot_lookup():
>             # do some mock code
> 
>      I think in this way we will have a significant reduction in our 
> mockmodel code.
> ----
> 
> I think with this refactoring we can make mockmodel more devel friendly 
> and avoid a lot of duplicated code.

I totally agree with you. If I didn't have that many features to
implement for the next release, I'd help on this one :-)

-- 
Best regards,
Crístian.





More information about the Kimchi-devel mailing list