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

Disabling a Test Case in the profile does not prevent it from being run if called explicitly #1284

Closed
tgreenx opened this issue Aug 30, 2023 · 3 comments · Fixed by #1294
Closed
Assignees
Labels
A-TestCase Area: Test case specification or implementation of test case S-PRforIssue Status: There is a PR that is meant to resolve the issue
Milestone

Comments

@tgreenx
Copy link
Contributor

tgreenx commented Aug 30, 2023

The profile can be used to prevent Test Cases from being run (i.e. by removing them from the profile). This is true when Engine runs the whole test suite, or even specific Test modules, but not when running specific Test Cases (i.e., using Zonemaster::Engine/test_method() or Zonemaster::Engine::Test/run_one()). That is because the checks are done directly in the all() method of each Test module (with the help of Zonemaster::Engine::Util/should_run_test()). That method is not used when running specific Test Cases.

For example, using Zonemaster-CLI, after removing Address01 from the profile (note that Engine is started twice because of two --test arguments):

$ zonemaster-cli --show-testcase --test Address --test Address/address01 --level DEBUG --no-ipv6 --raw zonemaster.net | grep TEST_CASE_START
   0.00 DEBUG    ADDRESS02      TEST_CASE_START   testcase=address02
   3.33 DEBUG    ADDRESS03      TEST_CASE_START   testcase=address03
   0.00 DEBUG    ADDRESS01      TEST_CASE_START   testcase=address01

It could be intentional, but that seems odd to me. So, bug or feature? I would advocate for the former.

@tgreenx tgreenx added the A-TestCase Area: Test case specification or implementation of test case label Aug 30, 2023
@tgreenx tgreenx added this to the v2023.2 milestone Aug 30, 2023
@matsduf
Copy link
Contributor

matsduf commented Aug 30, 2023

Yes, Engine is started twice, but I noticed when preparing data for #1281 that cache and blacklisting survive from the first run to the second run. But I think it would be better if Engine could be run once.

I think it is fine that you can include a test case not in the profile if you explicitly calls it. What is the problem of that? What do you think should happen? And why?

@tgreenx tgreenx self-assigned this Aug 30, 2023
@tgreenx
Copy link
Contributor Author

tgreenx commented Aug 31, 2023

I think it is fine that you can include a test case not in the profile if you explicitly calls it. What is the problem of that? What do you think should happen? And why?

The profile acts as a configuration file for Engine. I would except that removing (disabling) a Test Case from the configuration would make it inaccessible, in all cases. If disabled but called explicitly, I expect Engine to return an error (either MODULE_ERROR or UNKNOWN_METHOD).

@tgreenx tgreenx linked a pull request Sep 20, 2023 that will close this issue
@tgreenx tgreenx added the S-PRforIssue Status: There is a PR that is meant to resolve the issue label Sep 20, 2023
@matsduf
Copy link
Contributor

matsduf commented Mar 19, 2024

Resolved by #1294

@matsduf matsduf closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-TestCase Area: Test case specification or implementation of test case S-PRforIssue Status: There is a PR that is meant to resolve the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants