Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test module auto-detection less dynamic #580

Merged
merged 2 commits into from
Oct 1, 2019

Conversation

mattias-p
Copy link
Member

@mattias-p mattias-p commented Aug 12, 2019

This should fix a problem with Travis failing for zonemaster-backend.

The problem caused by Travis installing a newer version of Z::E being on top of an older version without properly cleaning up older version. A module named Z::E::Test::Example existed in the older version but was removed in the newer one. In addition to this there was an API change causing the old version of Z::E::Test::Example to be incompatible with the new version of Z::E.

The problem is solved by auto-detecting the Z::E::Test modules once and for all at configure-time instead of looking for any modules under the Z::E::Test namespace at run-time.

As a drive-by fix I also added to remove the necessity to install Z::E in @inc in development mode.

This is makes us resilient to situations where Z::E was updated but the
old verision was not properly cleaned up. It really helps on buggy SaaS CI
platforms where we don't have full control over the machines being used.
map { my $f = $_; $f =~ s|^Zonemaster::Engine::Test::||; $f }
grep { $_ ne 'Zonemaster::Engine::Test::Basic' } useall( 'Zonemaster::Engine::Test' );
BEGIN {
@all_test_modules = split /\n/, read_file( dist_file( 'Zonemaster-Engine', 'modules.txt' ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the best solution? Isn't better to create a perl module that lists the modules? I feel that the code would be simpler and more direct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to fix a bug here. As such I'm trying to change the design as little as possible.

Feel free to create an issue to make the module listing completely static.

@sandoche2k
Copy link
Contributor

@vlevigneron to review

Copy link
Contributor

@vlevigneron vlevigneron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I approve even if I'm not sure to understand all consequences (if any).

@mattias-p mattias-p merged commit 7881d07 into zonemaster:develop Oct 1, 2019
@mattias-p mattias-p deleted the resilient-modules branch May 5, 2020 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants