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

Fixing errors display when using options '--ns' or '--ds'

Open MichaelTimbert opened this issue 1 year ago • 1 comments

Purpose

This separate CLI errors from Engine errors. Errors on CLI argument are catch before displaying the header.

Context

Fixes #358

Changes

I have split CLI argument verification from Engine settings.

I have also add regex validation for '--ds' arguments

How to test this PR

Stress test zonemaster-cli with various '--ns' and '--ds' arguments. Errors from command line input validation must be display before any header. Errors from the Engine must be formatted correctly after the header.

here some example to cmd to run:

zonemaster-cli --show-testcase --no-ipv6 --test basic/basic01 zonemaster.net --ns 'ns1.zonemaster.net'
zonemaster-cli --show-testcase  example.fr --ns 'ns1.zonemaster..fr.'
zonemaster-cli --show-testcase  example.fr --ns 'ns1.zonemaster.fr/542.0.0.1'
zonemaster-cli --show-testcase  example.fr --ns '/215.4.6.1'
zonemaster-cli --show-testcase afnic.fr --ds "32674 13 2 12CCEEFE3ECD007C"
zonemaster-cli --show-testcase afnic.fr --ds "32674,13,2,NOTHEXADECIMAL"

MichaelTimbert avatar Aug 12 '24 12:08 MichaelTimbert

This PR is based on develop branch before the last release. I suggest that it is rebased on latest master or develop branch.

matsduf avatar Aug 21 '24 07:08 matsduf

@MichaelTimbert, can you please handle the conflicts?

matsduf avatar Oct 11 '24 13:10 matsduf

# zonemaster-cli --show-testcase --no-ipv6 --test Basic zonemaster.net --ns ns1.zonemaster.net --level info
   1.11 ERROR    Unspecified    The fake delegation of domain zonemaster.net includes an in-zone name server ns1.zonemaster.net without mandatory glue (without IP address).
  \ 
Seconds Level    Testcase       Message
======= ======== ============== =======
   0.00 INFO     Unspecified    Using version v6.0.0 of the Zonemaster engine.
   0.00 INFO     Basic01        The zone "zonemaster.net" is found.
   0.00 INFO     Basic01        This is a test of an undelegated domain so finding the parent zone is disregarded.
   0.16 CRITICAL Basic02        There is no working name server for "zonemaster.net" so it is unreachable.
   0.16 ERROR    Basic02        Name server "ns1.zonemaster.net" cannot be resolved into an IP address.

Why is the first message before the header?

I mistakenly moved the add_fake_* before displaying the header. it's now fixed.

MichaelTimbert avatar Oct 22 '24 09:10 MichaelTimbert

Release testing for 2024.2:

When trying the first command, the output doesn’t report any errors, although it should:

$ zonemaster-cli --show-testcase --no-ipv6 --test basic/basic01 zonemaster.net --ns 'ns1.zonemaster.net'
  \
Seconds Level    Testcase       Message
======= ======== ============== =======

All other command lines listed in the testing procedures show an error, without showing the “seconds, level, testcase, message” header at all, so I assume this works as expected.

I’ve created issue #402 to track this problem.

marc-vanderwal avatar Dec 02 '24 14:12 marc-vanderwal