zonemaster-engine icon indicating copy to clipboard operation
zonemaster-engine copied to clipboard

ASN DB settings get fixed on their initial values

Open mattias-p opened this issue 7 months ago • 0 comments

The Zonemaster::Engine::ASNLookup module has two global variables @db_sources and $db_style. These get computed once based on profile properties, but they are never reset. These global values should either be reset between test runs, or they shouldn't be global variables at all.

While these variables are publicly accessible to and could technically be reset from calling code, this requirement is not documented, it's not implemented in Backend, and it's rather bad API design. It would be better to add a class method called reset or something to the Zonemaster::Engine::ASNLookup module. This reset method should probably be called automatically from Zonemaster::Engine->reset() or perhaps Zonemaster::Engine::Test->{run_for_all,run_module,run_one}().

But really, from a quick look at the code I believe we should be able to recompute these values anew every time we need them and do away with the caching altogether.

mattias-p avatar Jul 22 '24 15:07 mattias-p