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

Custom test modules

Open mattias-p opened this issue 10 months ago • 1 comments

Depends on:

  • #1336

Zonemaster::Engine::Test/run_for_all() needs to know about all the test modules it should run and in which order to run them. Today it makes this determination by parsing a file from disk and prepending the built-in Basic test module. To run an additional test module you need to include it in the file.

This mechanism should be replaced like so:

  • Add a class method to Zonemaster::Engine::Profile that returns the Perl package that was provided to the test module registration method.
  • Add a class method to Zonemaster::Engine::Profile that returns the of test module names. The list should contain an entry for each registered test module. Test modules under 'Zonemaster::Engine::Test::' be ordered before any others. Within these two groups, test modules should be listed in the order they were registered.
  • Update Zonemaster::Engine::Test/modules() to call the new Profile method instead of using the old parse and prepend algorithm.
  • Update the test running methods in Zonemaster::Engine::Test to query the Profile module for the ordered set of test module names and their corresponding Perl modules.

mattias-p avatar Apr 04 '24 15:04 mattias-p

I'm not super-fond of the special handling of modules under 'Zonemaster::Engine::Test::'. The idea is that it should be impossible for 3rd party modules to get loaded before the built-in ones. Perhaps there is a better way to ensure this.

mattias-p avatar Apr 04 '24 15:04 mattias-p