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

Fix code in Basic01 #1249

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

tgreenx
Copy link
Contributor

@tgreenx tgreenx commented Jul 4, 2023

Purpose

This PR fixes the implementation of Basic01 by adding missing code due to an oversight during the initial implementation update (#1212).

It also adds conditional checks to the start of the Basic module and Test Cases (see "Scope" section of Basic01) that were also missed.

Context

Fixes #1248

Changes

  • Update and add missing code (step 7.3 of the specification)
  • Add missing conditional checks for the start of the Basic module and test cases ("scope" section of the specification)
  • Refactoring
  • Update unitary tests

How to test this PR

Check that this zone (from #1248) works correctly. Note that we do not have an unitary test for that kind of zone configuration yet.

$ zonemaster-cli zm2.zm1.andreasschulze.de --test=basic/basic01 --level=INFO
Seconds Level    Message
======= ======== =======
   0.01 INFO     Using version v4.7.0 of the Zonemaster engine.
   4.22 INFO     The zone "zm2.zm1.andreasschulze.de" is found.
   4.22 INFO     The parent zone is "andreasschulze.de." as returned from name servers "dahlem.somaf.de/185.183.157.243;dahlem.somaf.de/2a03:4000:1d:8e6::1;dallas.signing-milter.org/130.255.77.178;dallas.signing-milter.org/2a02:e00:ffec:8cd::1".

Check that a non existing zone, normal test makes Zonemaster:

  • Skip Basic02
  • Run Basic03
  • Abort the testing suite
$ zonemaster-cli example.fake --level=DEBUG --show-testcase --raw | grep TEST_CASE_START
   0.00 DEBUG    BASIC00        TEST_CASE_START   testcase=basic00
   0.00 DEBUG    BASIC01        TEST_CASE_START   testcase=basic01
   3.35 DEBUG    BASIC03        TEST_CASE_START   testcase=basic03

Check that a non existing zone, undelegated test makes Zonemaster:

  • Run Basic02
  • Run Basic03
  • Continue the testing suite
$ zonemaster-cli example.fake --level=DEBUG --show-testcase --raw --ns=ns1.example.fake/192.168.1.100 | grep TEST_CASE_START
   0.00 DEBUG    BASIC00        TEST_CASE_START   testcase=basic00
   0.00 DEBUG    BASIC01        TEST_CASE_START   testcase=basic01
   1.90 DEBUG    BASIC02        TEST_CASE_START   testcase=basic02
  11.93 DEBUG    BASIC03        TEST_CASE_START   testcase=basic03
  11.93 DEBUG    ADDRESS01      TEST_CASE_START   testcase=address01
  11.93 DEBUG    ADDRESS02      TEST_CASE_START   testcase=address02
  12.91 DEBUG    CONNECTIVITY01 TEST_CASE_START   testcase=connectivity01
  12.91 DEBUG    CONNECTIVITY02 TEST_CASE_START   testcase=connectivity02
  [...]

@tgreenx tgreenx added T-Bug Type: Bug in software or error in test case description A-TestCase Area: Test case specification or implementation of test case V-Patch Versioning: The change gives an update of patch in version. labels Jul 4, 2023
@tgreenx tgreenx added this to the v2023.1.1 milestone Jul 4, 2023
@tgreenx tgreenx requested review from mattias-p, matsduf, hannaeko, a user and marc-vanderwal July 4, 2023 14:34
@tgreenx tgreenx linked an issue Jul 4, 2023 that may be closed by this pull request
@tgreenx
Copy link
Contributor Author

tgreenx commented Jul 4, 2023

I will draft this PR for now as I will add more changes, unrelated to the mentioned issue.

@tgreenx tgreenx marked this pull request as draft July 4, 2023 16:04
@tgreenx tgreenx force-pushed the fix-basic01 branch 2 times, most recently from 9df575a to bd7d10e Compare July 4, 2023 17:17
@tgreenx tgreenx marked this pull request as ready for review July 4, 2023 17:30
@tgreenx
Copy link
Contributor Author

tgreenx commented Jul 4, 2023

I will draft this PR for now as I will add more changes, unrelated to the mentioned issue.

This PR is now ready for review.

@tgreenx
Copy link
Contributor Author

tgreenx commented Jul 4, 2023

@matsduf Github checks are not running it seems, I'm not sure on how to trigger them manually. I think I need to repush something in the PR for that to happen. Maybe you know of another way.

@matsduf
Copy link
Contributor

matsduf commented Jul 5, 2023

@matsduf Github checks are not running it seems, I'm not sure on how to trigger them manually. I think I need to repush something in the PR for that to happen. Maybe you know of another way.

CI checks will only start if the branch name matches the following as far as I can see:

    branches:
      - develop
      - master
      - 'releases/**'

@matsduf
Copy link
Contributor

matsduf commented Jul 5, 2023

Now the release branch has been renamed, and CI will run. Push an empty commit to the branch to trigger CI to run.

These changes are to align the code with the specification.
- Update and add missing code (step 7.3 of the specification - relates to issue zonemaster#1248)
- Add missing conditional checks for the start of the Basic module and test cases ("scope" section of the specification")
- Refactoring
- Update unitary tests
Copy link
Contributor

@marc-vanderwal marc-vanderwal left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@tgreenx tgreenx merged commit 0d85087 into zonemaster:releases/v2023.1.1 Jul 18, 2023
@tgreenx tgreenx deleted the fix-basic01 branch July 26, 2023 09:47
tgreenx added a commit to tgreenx/zonemaster-engine that referenced this pull request Aug 2, 2023
Commit f1354e1 (zonemaster#1249) introduced a bug (regression) when comparing domain names. It was using the function 'index()' to make such a comparison, on names that were no longer in their FQDN form. Thus, any domain name beginning with the characters of its TLD (e.g. 'norid.no') would wrongly be discarded. But even if that bug was reverted, it could still be problematic for multi-level zones, e.g. 'no.norid.no'.
So, instead of relying on a pure Perl function that does string comparison, in this commit we make use of the Zonemaster::Engine::DNSName class, specifically its function 'common()', to count the common labels between domain names.
tgreenx added a commit to tgreenx/zonemaster-engine that referenced this pull request Aug 2, 2023
Commit f1354e1 (zonemaster#1249) introduced a bug (regression) when comparing domain names. It was using the function 'index()' to make such a comparison, on names that were no longer in their FQDN form. Thus, any domain name beginning with the characters of its TLD (e.g. 'norid.no') would wrongly be discarded. But even if that bug was reverted, it could still be problematic for multi-level zones, e.g. 'no.norid.no'.
So, instead of relying on a pure Perl function that does string comparison, in this commit we make use of the Zonemaster::Engine::DNSName class, specifically its function 'common()', to count the common labels between domain names.
@tgreenx tgreenx mentioned this pull request Aug 2, 2023
tgreenx added a commit to tgreenx/zonemaster-engine that referenced this pull request Aug 2, 2023
Commit f1354e1 (zonemaster#1249) introduced a bug (regression) when comparing domain names. It was using the function 'index()' to make such a comparison, on names that were no longer in their FQDN form. Thus, any domain name beginning with the characters of its TLD (e.g. 'norid.no') would wrongly be discarded. But even if that bug was reverted, it could still be problematic for multi-level zones, e.g. 'no.norid.no'.
So, instead of relying on a pure Perl function that does string comparison, in this commit we make use of the Zonemaster::Engine::DNSName class, specifically its functions 'common()' and 'is_in_bailiwick', to count and compare the labels composing domain names.
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 T-Bug Type: Bug in software or error in test case description V-Patch Versioning: The change gives an update of patch in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test BASIC01 fail since v2023.1 for subzones
3 participants