zonemaster-engine
zonemaster-engine copied to clipboard
ASN DB settings get fixed on their initial values
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.