On Wed, Aug 9, 2017 at 8:55 AM, Miroslava Voglova <mvoglova@redhat.com> wrote:
Hi,

I am currently moving all option values from ConfigValues to database. It should make this values more readable and less error prone, since all will be in one place. Also it will allow engine-config to work with all available options and provide a way to find out if option is versioned, or has one general value.

But I encountered problem with unit tests. Some tests (tests that use MockConfigRule e.g. NetworkInSyncWithVdsNetworkInterfaceTest) rely on getting default value from ConfigUtilBase#getValue, which will no longer be possible, because there will be no @DefaultValueAttribute. As I understand, this tests cannot get values from database either.

​Looking at code, it seems that ConfigUtilsBase makes the assumption that default value for given VdcOption [1] is available through annotations, driven by the presence of @TypeConverterAttribute + @DefaultValueAttribute. If we want to remove those annotations throughout ConfigValues, we could consider adapting ConfigUtilsBase accordingly.

[1] ConfigUtilsBase#getValue(VdcOption)​

​Or, simply allow the test to specify the given VdcOption's default value explicitly (avoid relying on annotation-driven default value resolution) which can reduce the amount of "magic" in the test :-)


Does someone have an idea how to solve this problem? I was thinking about changing MockConfigRule to get values from 000_config.sql, but I am not sure if this change won't cause some other issues. 

Thanks,
Mirka


_______________________________________________
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel