Skip to content

Fix typo in unit test of BASIC02#1465

Merged
marc-vanderwal merged 1 commit into
zonemaster:developfrom
marc-vanderwal:bugfix/test-basic02
Jul 28, 2025
Merged

Fix typo in unit test of BASIC02#1465
marc-vanderwal merged 1 commit into
zonemaster:developfrom
marc-vanderwal:bugfix/test-basic02

Conversation

@marc-vanderwal

@marc-vanderwal marc-vanderwal commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

Purpose

This PR fixes a typo in the t/test-Basic02.t file that caused one of the scenarios, GOOD-2, not to be tested at all.

The scenario GOOD-2 erroneously pointed to the test zone named good-1.basic02.xa, where it should have pointed to good-2.basic02.xa.

Context

Issue found during refactoring.

Changes

  • Fix typo in t/test-Basic02.t;
  • Rerecord companion .data file.

How to test this PR

Unit tests should pass.

The scenario named GOOD-2 erroneously referred to a test zone named
good-1.basic02.xa, instead of good-2.basic02.xa. Because of that,
scenario GOOD-2 was not properly tested.

Simply fixing the typo was not enough. No data was recorded about
good-2.basic02.xa at all, so the companion .data file also needed to be
regenerated.
@marc-vanderwal marc-vanderwal added this to the v2025.2 milestone Jul 28, 2025
@marc-vanderwal marc-vanderwal added the A-TestCase Area: Test case specification or implementation of test case label Jul 28, 2025
@marc-vanderwal marc-vanderwal changed the title Fix typo in unit test for BASIC02 Fix typo in unit test of BASIC02 Jul 28, 2025
@matsduf

matsduf commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

Such an error is hard to find! Good spot!

@tgreenx tgreenx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Adding a check in t/TestUtil.pm would be great to catch those mistakes, as in most cases the zone name is derived from the test scenario name and test case name, but unfortunately that is not always the case

@marc-vanderwal marc-vanderwal merged commit c7a56e5 into zonemaster:develop Jul 28, 2025
3 checks passed
@matsduf

matsduf commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

Adding a check in t/TestUtil.pm would be great to catch those mistakes, as in most cases the zone name is derived from the test scenario name and test case name, but unfortunately that is not always the case

The only scenarios when it is not is when the zone is the root zone, a TLD or an ARPA zone. The check could ignore those, and then most cases would be caught.

marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Jul 28, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
@marc-vanderwal marc-vanderwal deleted the bugfix/test-basic02 branch July 29, 2025 12:10
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Jul 29, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Jul 30, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Jul 30, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Aug 7, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Aug 7, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
@matsduf matsduf added V-Patch Versioning: The change gives an update of patch in version. RC-None Release category: Not to be included in Changes file. labels Aug 10, 2025
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Oct 15, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
marc-vanderwal added a commit to marc-vanderwal/zonemaster-engine that referenced this pull request Oct 16, 2025
Rewriting this test file to use the DSL helped me find a typo in the
original t/Test-basic02.t file that caused the GOOD-2 scenario to point
to good-1.basic02.xa instead of good-2.basic02.xa (see PR zonemaster#1465).

It’s a good demonstration of why it can be important to design data
structures and formats in such a way that internal repetition is avoided
unless absolutely necessary: when done right, it makes subtle errors
like these more obvious.
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 RC-None Release category: Not to be included in Changes file. 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.

3 participants