Commit graph

11259 commits

Author SHA1 Message Date
Matthijs Mekking
cf23303dd9 Add a DNSSEC policy test case for a special zone
Try to create a key for a zone, and then sign it, that has some special
characters in the name.

(cherry picked from commit 6a4f3ec242)
2023-11-20 12:10:30 +01:00
Mark Andrews
734061ac1b Emit "no servers could be reached" for TCP as well as UDP
When all the servers are exhausted for TCP emit "no servers could
be reached" in tcp_connected.  This message is already emitted for
UDP.

(cherry picked from commit 831efa40d6)
2023-11-20 13:40:19 +11:00
Evan Hunt
6b47d98a95 set loadtime during initial transfer of a secondary zone
when transferring in a non-inline-signing secondary for the first time,
we previously never set the value of zone->loadtime, so it remained
zero. this caused a test failure in the statschannel system test,
and that test case was temporarily disabled.  the value is now set
correctly and the test case has been reinstated.

(cherry picked from commit 9643281453)
2023-11-15 18:06:58 -08:00
Mark Andrews
dc0671e724 Adjust message buffer sizes in test code
(cherry picked from commit cbfcdbc199)
2023-11-16 12:22:08 +11:00
Tony Finch
1b138a5883 Fix missing newlines in output of rndc nta -dump
There were no newlines between each view in the list of negative trust
anchors.

(cherry picked from commit 61b245e318)
2023-11-03 08:28:18 +01:00
Mark Andrews
15e13bd523 Update b.root-servers.net IP addresses
This covers both root hints and the default primaries for the root
zone mirror.  The official change date is Nov 27, 2023.

(cherry picked from commit 2ca2f7e985)
2023-11-03 03:43:49 +11:00
Mark Andrews
b4352bbc6f Cleanup dead code in dnstap-read
Remove 'b' from main as it is unused.

(cherry picked from commit 0482451f84)
2023-11-02 10:09:44 +00:00
Tom Krizek
8c8ff7faea
Fix pytest junitxml output processing for make check
Not every element tagged `skipped` in the JUnitXML tree has to contain
the `type` attribute. An example of that is a test that results in
xpass.

This has been verified with pytest version 7.4.2 and prior.

(cherry picked from commit ba25ecd2d2)
2023-11-02 10:02:51 +01:00
Matthijs Mekking
784b096098 Test case for issue #4355
Add a test case where serve-stale is enabled on a server that also
servers a local authoritative zone.

The particular case tests a lame delegation and checks if falling
back to serving stale data does not attempt to retrieve the query
by recursing from the root down.

(cherry picked from commit e196ba6168)
2023-10-31 13:52:01 +01:00
Aram Sargsyan
08de15e5f2 Do not warn about lock-file option change when -X is used
When -X is used the 'lock-file' option change detection condition
is invalid, because it compares the 'lock-file' option's value to
the '-X' argument's value instead of the older 'lock-file' option
value (which was ignored because of '-X').

Don't warn about changing 'lock-file' option if '-X' is used.

(cherry picked from commit 41945b32d7)
2023-10-26 13:12:57 +00:00
Aram Sargsyan
4ed32424c8 Fix an invalid condition check when detecting a lock-file change
It is obvious that the '!cfg_obj_asstring(obj)' check should be
'cfg_obj_asstring(obj)' instead, because it is an AND logic chain
which further uses 'obj' as a string.

Fix the error.

(cherry picked from commit bc891e749f)
2023-10-26 13:12:52 +00:00
Aram Sargsyan
1bff704681 Fix assertion failure when using -X none and lock-file in configuration
When 'lock-file <lockfile>' is used in configuration at the same time
as using '-X none' in 'named' invocation, there is an invalid
logic that would lead to a isc_mem_strdup() call on a NULL value.

Also, contradicting to ARM, 'lock-file none' is overriding the '-X'
argument.

Fix the overall logic, and make sure that the '-X' takes precedence to
'lock-file'.

(cherry picked from commit fc2dd09390)
2023-10-26 13:12:47 +00:00
Ondřej Surý
d9fc95f842
Fix assertion failure when using -X and lock-file in configuration
When 'lock-file <lockfile1>' was used in configuration at the same time
as using `-X <lockfile2>` in `named` invocation, there was an invalid
logic that would lead to a double isc_mem_strdup() call on the
<lockfile2> value.

Skip the second allocation if `lock-file` is being used in
configuration, so the <lockfile2> is used only single time.

(cherry picked from commit 4f68def5e9)
2023-10-26 13:59:46 +02:00
Tom Krizek
b8b9b4ac2c
Reformat shell scripts with shfmt
All changes in this commit were automated using the command:

shfmt -w -i 2 -ci -bn . $(find . -name "*.sh.in")

By default, only *.sh and files without extension are checked, so
*.sh.in files have to be added additionally. (See mvdan/sh#944)

(manually replayed commit 4cb8b13987)
2023-10-26 13:05:00 +02:00
Mark Andrews
74ab7e4660 Check that the lock file was not removed too early
When named fails to starts due to not being able to obtain
a lock on the lock file that lock file should remain.  Check
that the lock file exists before and after the attempt to
start a second instance of named.

(cherry picked from commit 811c9ee7d1)
2023-10-26 18:05:07 +11:00
Mark Andrews
534cadba3a Only remove the lock file if we managed to lock it
The lock file was being removed when we hadn't successfully locked
it which defeated the purpose of the lockfile.  Adjust cleanup_lockfile
such that it only unlinks the lockfile if we have successfully locked
the lockfile and it is still active (lockfile != NULL).

(cherry picked from commit b9c789b8b3)
2023-10-26 18:05:07 +11:00
Michal Nowak
114551659e
Add test for CVE-2023-3341
(cherry picked from commit 7d1834b250)
2023-10-20 16:27:31 +02:00
Michal Nowak
7c6632e174
Update the source code formatting using clang-format-17 2023-10-18 09:02:57 +02:00
Matthijs Mekking
e3f65d465c Two minor fixes in the kasp system test
The 'dynamic-signed-inline-signing.kasp' zone was set up with
the environment variable 'ksktimes', but that should be 'csktimes'
which is set one line above. Since the values are currently the same
the behavior is identical, but of course it should use the correct
variable.

The 'step4.enable-dnssec.autosign' zone was set up twice. This is
unnecessary.

(cherry picked from commit 21d04f556d)
2023-10-16 12:34:52 +02:00
Matthijs Mekking
e9989c541b Add test case for GL #4350
Add a test scenario for a dynamic zone that uses inline-signing which
accidentally has signed the raw version of the zone.

This should not trigger resign scheduling on the raw version of the
zone.

(cherry picked from commit c90b622648)
2023-10-16 10:33:25 +02:00
Mark Andrews
745db8775b Document that reloading happens asynchronously
(cherry picked from commit e33dbd0cbd)
2023-09-26 14:11:30 +10:00
Mark Andrews
de94bee5f3 Wait for the test zone to finish re-loading
'rndc thaw' initiates asynchrous loading of all the zones
similar to 'rndc load'.  Wait for the test zone's load to
complete before testing that it is updatable again.

(cherry picked from commit 5b3238aa85)
2023-09-26 14:11:30 +10:00
Michał Kępień
2f08b622bf Merge tag 'v9.18.19' into bind-9.18 2023-09-20 16:52:16 +02:00
Tom Krizek
2ad197b37d
Rename convenience symlink to pytest artifacts
The previous symlink name convention was prone to name collisions If a
system test contained both a shell test and a pytest module of the same
name (e.g. dnstap test has both tests.sh and tests_dnstap.py), then
these would have the same convenience symlink, which could cause test
setup issues as well as confusion when examining test artifacts.

Update the naming convention to include the full pytest module name.
This results in a slightly more verbose names for shell tests (e.g.
dnstap_sh_dnstap instead of the previous dnstap_dnstap), but it removes
the chance of a collision.

(cherry picked from commit fd13dfb097)
2023-09-20 16:04:40 +02:00
Tom Krizek
a5eb779c94
Update system test runner doc with pytest glue files
Document that pytest requires a glue file for each shell tests in order
to detect it.

(cherry picked from commit d050843a30)
2023-09-20 14:51:49 +02:00
Tom Krizek
60c4356554
Use integers for ports fixtures in pytest
Reorganize individual port fixtures and re-use the ports fixture to
obtain their number. Store it as integer and only cast it to string when
setting it as environment variable.

(cherry picked from commit 8deb026748)
2023-09-20 14:51:05 +02:00
Tom Krizek
0ac22ebc95
Reformat conftest.py with black
(cherry picked from commit 197dac55a2)
2023-09-20 14:51:05 +02:00
Tom Krizek
7a28a76885
Remove legacy runner support from conftest.py
Remove code fork for legacy runner, reorganize imports and move a
pylint-silencing snippet to the top of the file. The rest of the code
was just unindented.

(cherry picked from commit d16e5fd5e5)
2023-09-20 14:51:02 +02:00
Tom Krizek
98191e6371
Remove pytest invocation from legacy runner
In order to python system tests, pytest (runner) has to be used
directly. This makes it possible to simplify the pytest runner and make
its behavior simpler and easier to extend.

The legacy runner can still be used to run shell system tests.

(cherry picked from commit 4af9bafb4e)
2023-09-20 14:50:18 +02:00
Tom Krizek
8c1a1b304c
Use 0 exit code for skipped tests in legacy runner
Since the legacy runner is no longer used in the automake test suite,
don't use the special GNU exit code indicating a skipped tests. Instead,
use 0 to avoid considering skipped tests as failed when using simpler
mechanism (such as xargs -P) to run the tests with the legacy runner.
2023-09-20 13:45:41 +02:00
Tom Krizek
01aada479c
Remove make check invocation from legacy.run.sh
The legacy runner no longer uses make check. Ensure the legacy runner
script doesn't interact with that automake target in any way. The legacy
runner script remains available to execute the legacy runner, but there
is no out-of-the box support for running tests in parallel. Other tools
such as xargs can be utilized for that.

(cherry picked from commit 0a9ee342e9)
2023-09-20 10:35:27 +02:00
Tom Krizek
ca392c6f64
Modify custom-test-driver to interpret JUnit results
Pytest provides JUnit output and uses different exit codes from
Automake. Use the conversion script to interpret the JUnit test results
from python rather than relying on the status code.

(cherry picked from commit 295890a16b)
2023-09-20 10:33:42 +02:00
Tom Krizek
fce6fa0fc4
Convert JUnit XML from pytest into Automake .trs files
It's important to parse the JUnit result file rather than relying on the
exit code from pytest, which has a different meaning. Include a .trs test
result for each test case and set an exit code which is most appropriate
as the aggregate result (e.g. it will be set to 77 (SKIP) if there's at
least one test case that was skipped).

(cherry picked from commit b96c8e8062)
2023-09-20 10:33:42 +02:00
Tom Krizek
68f186dd82
Prioritize long-running system tests for legacy runner
Synchronize the test priority with the pytest runner (which handles the
prioritization in conftest.py).

(cherry picked from commit 15fa8f1506)
2023-09-20 10:33:38 +02:00
Tom Krizek
a28529c11d
Use prereq.sh for rpzrecurse system test
(cherry picked from commit 0538b7e0da)
2023-09-20 10:32:11 +02:00
Tom Krizek
3fb1f2e851
Use prereq.sh for serve-stale system test
(cherry picked from commit c3abedc0a2)
2023-09-20 10:32:11 +02:00
Tom Krizek
27c3e576fd
Use prereq.sh for chain system test
(cherry picked from commit 5d9a09c086)
2023-09-20 10:32:11 +02:00
Tom Krizek
74def754f9
Use prereq.sh for digdelv, dnssec, forward system tests
(cherry picked from commit 00b92bd064)
2023-09-20 10:32:11 +02:00
Tom Krizek
53a09edc4f
Use prereq.sh for qmin, cookie system tests
(cherry picked from commit 78981cee77)
2023-09-20 10:32:11 +02:00
Tom Krizek
39770409a9
Use prereq.sh for reclimit system test
(cherry picked from commit 2f962f7041)
2023-09-20 10:32:11 +02:00
Tom Krizek
697041ae93
Use prereq.sh for xfer system test
(cherry picked from commit 587129b4c0)
2023-09-20 10:32:11 +02:00
Tom Krizek
cefa09ada5
Use prereq.sh for statschannel system test
(cherry picked from commit 27281955af)
2023-09-20 10:32:11 +02:00
Tom Krizek
c0e4411961
Add prereq.sh scripts for system tests requiring perl mod DNS
prereq.sh mechanism for dependency detection is preferred since it works
for both legacy and pytest runner.

(cherry picked from commit 9cc821d42f)
2023-09-20 10:32:10 +02:00
Tom Krizek
ee849d2a0c
Use proper perl interpreter in xfer system test
(cherry picked from commit f0493890cc)
2023-09-20 10:32:10 +02:00
Tom Krizek
76b5c07b8d
Remove redundant dependency checks for system tests
Dependencies for these tests are already checked in prereq.sh - if the
dependencies are missing, these tests will be skipped. The extra
dependency check in Makefile.am is extraneous and only applied for the
legacy test runner.

(cherry picked from commit 807f67b1cd)
2023-09-20 10:32:10 +02:00
Tom Krizek
9d9f2dcda5
Fix pytest module detection for run.sh
To allow concurrent invocations of pytest, it is necessary to assign
ports properly to avoid conflicts. In order to do that, pytest needs to
know a complete list of all test modules.

When pytest is invoked from run.sh, the current working directory is the
system test directory. To properly detect other tests, the conftest.py
has to look in the bin/tests/system directory, rather than the current
working directory.

(cherry picked from commit d4502206a1)
2023-09-20 10:32:10 +02:00
Tom Krizek
b86a41780a
Use pytest runner for make check
Make python & pytest required dependencies to run system tests and
invoke the pytest runner from the makefile.

(cherry picked from commit 56c1087304)
2023-09-20 10:32:05 +02:00
Tom Krizek
56e842bbf2
Rename allow-query pytest glue file
To conform with the expected naming convention, the pytest glue file for
the `allow-query` test should use underscore as the word separator in
the python file name: allow-query/tests_sh_allow_query.py

(cherry picked from commit c026a00696)
2023-09-19 14:56:21 +02:00
Tom Krizek
09a8dd2f5b
Treat bin/tests/system/_common as non-temp directory
The _common directory is a special case directory which contains shared
files for other system test directories. Make sure it's tracked in git
and not deleted during temporary directory cleanup.

(cherry picked from commit 9e13c3dbcb)
2023-09-19 14:56:21 +02:00
Tom Krizek
f9e075175d
Rename system test directory with common files to _common
The old name "common" clashes with the convention of system test
directory naming. It appears as a system test directory, but it only
contains helper files.

To reduce confusion and to allow automatic detection of issues with
possibly missing test files, rename the helper directory to "_common".
The leading underscore indicates the directory is different and the its
name can no longer be confused with regular system test directories.

(cherry picked from commit 168dba163c)
2023-09-19 14:56:12 +02:00