Commit graph

12716 commits

Author SHA1 Message Date
Nicki Křížek
684acd7caf Use jinja2 templates in statistics test
- Merge ns*/statistics-channels.conf.in config snippets into
  conditionally rendered section in ns*/named.conf.j2 files.
- Turn ns2/named.conf.in into ns2/named1.conf.j2 because it is used
  later in the test to restore the original config.
- Symlink the ns2/named.conf.j2 ns2/named1.conf.j2 to pick a starting
  config.

(cherry picked from commit cb88d1eda6)
2025-12-10 13:43:52 +01:00
Nicki Křížek
42e1f010d7 Use jinja2 templates in synthfromdnssec test
- Merge ns*/statistics-channels.conf.in config snippets into
  conditionally rendered section in ns*/named.conf.j2 files.

(cherry picked from commit 719c656d2b)
2025-12-10 13:43:52 +01:00
Nicki Křížek
5e530cefb5 Use jinja2 templates in tsig test
- Rename ns1/named-fips.conf.in to ns1/named.conf.j2.
- Move MD5-specific stuff into ns1/named-md5.conf.j2 and include it
  conditionally.

(cherry picked from commit 8db37ac31c)
2025-12-10 13:43:52 +01:00
Nicki Křížek
e5d7ab2d8f Use jinja2 templates in rpzrecurse test
- Change ns2 header into jinja2 template.
- Keep the various ns2 config files as non-templates, same for the
  named.default.conf to be consistent.
- Symlink the ns2/named.default.conf as a jinja2 template to pick a
  starting config. It is rendered as a template to avoid an error when
  the test would overwrite a git-tracked file.
- Use jinja2 templates for the ns3 files, keep named1.conf around
  because it's needed later in the test to restore the config. Symlink
  it to `ns3/named.conf.j2` to select a default config.

(cherry picked from commit 16e9ac4710)
2025-12-10 13:43:52 +01:00
Nicki Křížek
cd78f8a9ec Use jinja2 templates in nsupdate test
- Merge ns1/tls.options.in into ns1/named.conf.j2 and render it
  conditionally. Also conditionally include the additional
  ns1/tls.conf.j2 which is always rendered.
- Use multiple templates for ns7 and replace the copy_setports.
- Use jinja2 template for verylarge.in as well.

(cherry picked from commit 54c95d6966)
2025-12-10 13:43:52 +01:00
Nicki Křížek
ca39053b81 Use jinja2 templates in notify test
- Merge options-tls.conf into named.conf in ns2 and ns4 and render it
  conditionally. Also conditionally include the additional
  named-tls.conf which is always rendered.

(cherry picked from commit 9fc446b6f5)
2025-12-10 13:43:52 +01:00
Nicki Křížek
20e97ca13c Use jinja2 templates in forward test
- Merge options-tls.conf into named.conf in ns2 and ns4 and render it
  conditionally. Also conditionally include the additional
  named-tls.conf which is always rendered.
- Use multiple templates for ns3 and ns9 and replace the copy_setports.
- In ns3/named2.conf, use "root2.db" directly rather than replacing it
  with "sed" later.

(cherry picked from commit 8e525f2154)
2025-12-10 13:43:52 +01:00
Nicki Křížek
28e1910a59 Use jinja2 templates in logfileconf test
- Replace all named*.in files with jinja2 templates.
- Rename the config files to named.*.conf convention.
- Rename named.plain.in to named.plain.conf.j2 and symlink it as te
  default config.
- Rename named.plainconf.in to named.plainlog.conf.j2 (there is a slight
  difference from named.plain, despite the similar name)

(cherry picked from commit 3f953266fb)
2025-12-10 13:43:52 +01:00
Nicki Křížek
ce00f2d059 Use jinja2 templates in runtime test
- Replace named-altX.conf.in with namedX.conf.j2 to stick with the same
  naming convention across the entire code base. Note than due to
  named1.conf being the first (default) config, the numbers for the altX
  are incremented.
- Turn alt9 into named7 to stick with the same number sequence. Adjust
  the related file names accordingly.

(cherry picked from commit 7f3b0afb09)
2025-12-10 13:43:52 +01:00
Nicki Křížek
f16c679360 Use jinja2 templates in checkzone test
Render the bad-tsig.db file using jinja2 template to get rid of
copy_setports.

Since the zone is using @ character, use the raw directive to avoid
interpreting it as a variable start.

(cherry picked from commit b23301ec55)
2025-12-10 13:43:52 +01:00
Nicki Křížek
a6d9804ad8 Use jinja2 templates in autosign test
- Include ns3/nsec-only.conf conditionally and always render it.

(cherry picked from commit 13bd0d689a)
2025-12-10 13:43:52 +01:00
Nicki Křížek
425af8d0b1 Use jinja2 templates in tsiggss
- The ns1/named.conf.j2 contains "@" which is a special jinja character,
  use the raw directive to escape it.

(cherry picked from commit 1aa2f7249a)
2025-12-10 13:43:52 +01:00
Nicki Křížek
38c779740f Use jinja2 templates in transport-change test
- Replace named*.conf.in files with jinja2 templates.
- When applying the files use plain cp command to copy the rendered
  files.

(cherry picked from commit 0f37603b1a)
2025-12-10 13:43:52 +01:00
Nicki Křížek
8dde4093aa Replace .in with .j2 templates for cases with namedX.conf
The following tests use multiple named configs. Previously, these have
been rendered with copy_setports in tests.sh when needed. Transform
these into jinja2 templates and render them during setup. In the tests,
the copy_setports invocations can be then replaced with a simple cp.

(cherry picked from commit 9d3279a542)
2025-12-10 13:43:52 +01:00
Nicki Křížek
ea10064b95 Replace .in with .j2 templates for simple copy_setports cases
Use jinja2 templates instead of *.in templates for named.conf and remove
the copy_setports invocations from setup.sh which are no longer needed.

(cherry picked from commit fc10cb686d)
2025-12-10 13:43:52 +01:00
Nicki Křížek
d92b1fa169 Allow any named*.conf file as a system test artifact
This allows rendering multiple named*.conf files using the jinja2
template engine at test start and then simply copying the required
config to named.conf as needed.

(cherry picked from commit d6d6db52e3)
2025-12-10 13:43:52 +01:00
Štěpán Balážik
9d402aa100 Match JUnit test names of system tests in the legacy test runner
Pytest sets the test names as `test_foo` and the old test runner spits
out `bin/tests/system/foo`.

Normalize this to match the new test runner.
2025-12-10 12:04:02 +00:00
Nicki Křížek
13205c8a56 Remove system test env var for nonexistent feature
This is a fixup for MR!11345. The variable for --extended-ds-digest was
accidentally backported - 9.20 doesn't have this feature check.
2025-12-09 16:30:36 +01:00
Mark Andrews
89d4d90244 log failing buffer
(cherry picked from commit 066847af25)
2025-12-09 11:12:24 +00:00
Aram Sargsyan
b21b698405 Add a check to the catz test to confirm that the issue is fixed
Use a member zone with a long list of primaries with long key
names to trigger the issue that was fixed by the previous commit.

(cherry picked from commit 2622140482)
2025-12-09 11:12:24 +00:00
Michal Nowak
acd6d5f954 dns.name module does not have minversion attribute
The dns module does have it.

(cherry picked from commit ed33f44829)
2025-12-09 10:22:03 +00:00
Nicki Křížek
b612786d5f Add FEATURE_* environment variables to system tests
The purpose of these variables is to be able to detect feature support
without calling feature-test. This becomes useful when detecting feature
support in jinja2 templates.

(cherry picked from commit 19af19b31c)
2025-12-08 20:14:36 +01:00
Nicki Křížek
46189a254b Remove unused dlz-filesystem feature check
There isn't any system test that uses this feature check.

(cherry picked from commit 2bb840bbc7)
2025-12-08 18:54:30 +01:00
Nicki Křížek
69851297ad Remove unused ipv6only feature check
There isn't any system test that uses this feature check.

(cherry picked from commit 789e40bd4c)
2025-12-08 18:54:29 +01:00
Nicki Křížek
6f51eeb8ef Refactor NamedInstance.rndc() to use EnvCmd() interface
To unify the command handling, utilize EnvCmd() to handle rndc commands:

1. Remove isctest.rndc abstractions. They were intended for an upcoming
   python-only implementation. A couple of years later, it doesn't seem
   to be coming any time soon, so let's stick with the interface that
   makes sense today, i.e. use the same command handling interface
   everywhere.
2. Remove the specialized rndc.log in favor of the generic logging
   already implemented by isctest.run.cmd(). I believe the cause of the
   many rndc(log=False) invocations was that nobody wanted this extra
   file. Yet, logging everything by default makes sense for debugging,
   unless there's a good reason not to. In almost all cases, logging was
   switched to the default (enabled).
3. With the NamedInstance.rndc() call now returning CmdResult rather
   than combined stdout+stderr string, adjust all the invocations to use
   `.out` or `.err` as necessary.
4. Replace some manual rndc invocation and its base argument
   construction with the standardized nsX.rndc() call.
5. In cases where rndc is expected to fail, utilize
   raise_on_exception=False and check the `.rc` from the result, rather
   than handling an exception.
6. In addzone/tests_rndc_deadlock.py, refactor the test slightly to
   avoid using EnvCmd() entirely to avoid spamming the logs. This test
   calls rndc in a loop from multiple threads and such test case is an
   exception which doesn't warrant changing the `isctest.run.cmd()`
   implementation.

(cherry picked from commit f33e2b6d87)
2025-12-08 17:07:57 +01:00
Nicki Křížek
0f64e490bb Add generic isctest.run.EnvCmd helper to pytest
A generic helper that calls the environment-specified binaries in a
developer-friendly manner, i.e. passing arguments as strings rather than
having to split them first.

The isctest.run.cmd() remains as the basis which provides a clean and
robust interface, while the isctest.run.EnvCmd() can be used as a
convenient wrapper for tests, or when there are some shared default
parameters.

The isctest.run.Dig() is superseded with the isctest.run.EnvCmd(). In
the future, we might revisit adding Dig() or command-specific helpers
again, but it probably only makes sense if they offer command-aware
attributes / methods, rather than just being shortcuts to
isctest.run.EnvCmd().

(cherry picked from commit ff613a72d7)
2025-12-08 17:05:46 +01:00
Nicki Křížek
1b3e2f004f Add pylint check for re.compile() alias
Ensure that Re() is used consistently across our code base.

(cherry picked from commit a8bf53411d)
2025-12-08 17:05:38 +01:00
Nicki Křížek
b7a0aedd54 Improve file handling in ksr test
Refactor the file handling to write to a file directly when calling
isctest.run.cmd().

Refactor the existing code to use CmdResult rather than out and err
separately.

(cherry picked from commit 9bad9491a1)
2025-12-08 17:05:30 +01:00
Nicki Křížek
634b1a56a8 Use Text with Grep support in isctest.run.cmd()
When commands are executed using the isctest.run.cmd() command, allow
the output to be Grep-able like logs and text files.

(cherry picked from commit 4b6a86b029)
2025-12-08 17:05:08 +01:00
Nicki Křížek
249dbeddf8 Refactor LogFile into TextFile with Grep support
Add a new Grep-like interface which can be used for searching for
regular expressions in files. Replace the prior LogFile used for named
logs with the new TextFile interface.

(cherry picked from commit 7743bab5fc)
2025-12-08 17:04:39 +01:00
Nicki Křížek
98f5c5774d Move text-related operations into isctest.text module
Add a new module for working with text and keep the isctest.log.watchlog
module focused on its purpose. Move LogFile and LineReader into the new
module. Add compile_pattern() helper which will be useful in subsequent
commits.

(cherry picked from commit be6bae2a75)
2025-12-08 17:03:43 +01:00
Nicki Křížek
631e366dcf Use Re() for creating regular expressions
It's a fairly common pattern to use regular expression in our tests.
Instead of using the fairly verbose re.compile(), import that function
as Re() instead to allow for more brevity in the test syntax.

(cherry picked from commit ac7127d620)
2025-12-08 17:03:29 +01:00
Nicki Křížek
182c7c83a8 Use CmdResult to decode stdout/stderr from isctest.run.cmd()
Avoid repeating the .decode("utf-8") snippet when processing command
output and provide a helper instead, which leads to more concise code.

(cherry picked from commit ac998da3f6)
2025-12-08 16:58:13 +01:00
Nicki Křížek
e34e744bb7 Utilize nsX.rndc() helper
Remove the duplicated code and replace it with nsX.rndc() call.

(cherry picked from commit ac2be27f8f)
2025-12-08 16:51:06 +01:00
Matthijs Mekking
da8cef5ade Fix statschannel system test
The manykeys test case relies on keys being removed. Make sure the
zone is fully signed with the keys that will stay, so the other keys
may be removed safely.

This means the expected number of signatures generated and refreshed
will change. The CDS and CDNSKEY RRset also need to be signed now.

Configure the test case with sig-signing-signatures 100, large enough
that the entire zone is processed in a single step.

(cherry picked from commit 14a243a81d)
2025-12-05 13:22:30 +01:00
Matthijs Mekking
5b85b93847 Fix nsec3 system test
The nsec3 system test has a couple of cases where the configured policy
changes the algorithm, effectively triggering an algorithm rollover. Fix
those cases to start in a valid DNSSEC state. Then fix the expected key
states, no longer should the old algorithm be removed immediately.

(cherry picked from commit a8339be0f8)
2025-12-05 13:22:23 +01:00
Matthijs Mekking
fe84bb6056 Fix autosign system test
When creating keys, set Publish and Activate times so that keys will
be initialized as omnipresent. This way we start with a safe DNSSEC
state. In most cases at least, because some tests depend on special
key timings.

The ttl[1-4].example cases have become incorrect. With dnssec-policy
we require the TTL to match the dnskey-ttl from the policy.

The delzsk.example will have a ZSK removed from the zone. It also
requires that the DNSKEY RRset is already published. This means
that for the existing keys the, no longer "is now published"
messages will be logged.

The nsec-only.example and reconf.example zones are fixed to have a
correct matching policy.

This all means the expected count of log messages changes slightly.

(cherry picked from commit c756b8a505)
2025-12-05 13:22:16 +01:00
Matthijs Mekking
21c99687a6 Fix views system test
This test case enables DNSSEC and has a mismatch in policy. Fix the
policy so that it matches the existing key set, and adjust the
expected answer count because no longer a new key is generated.

(cherry picked from commit 67ea0e656b)
2025-12-05 13:22:09 +01:00
Matthijs Mekking
aeaa5f12c1 Rollover test case for rumoured zone signatures
Test a manual rollover when zone signatures have not become omnipresent
yet. This should not immediately remove the predecessor key.

(cherry picked from commit 149ca5d46a)
2025-12-05 12:08:22 +00:00
Evan Hunt
25c9fb54da standardize CHECK and RETERR macros
previously, there were over 40 separate definitions of CHECK macros, of
which most used "goto cleanup", and the rest "goto failure" or "goto
out". there were another 10 definitions of RETERR, of which most were
identical to CHECK, but some simply returned a result code instead of
jumping to a cleanup label.

this has now been standardized throughout the code base: RETERR is for
returning an error code in the case of an error, and CHECK is for jumping
to a cleanup tag, which is now always called "cleanup". both macros are
defined in isc/util.h.

(cherry picked from commit 52bba5cc34)
2025-12-03 19:17:20 -08:00
Matthijs Mekking
e026df2c32 Wait for log zone_needdump is more reliable
In some cases we wait for the log message "sending notifies" before
proceeding with the test case. Notifies are rate limited. They are not
sent on every change to the zone. The "zone_needdump" messages happen on
every change.

(cherry picked from commit c17ac42608)
2025-12-01 14:24:45 +01:00
Matthijs Mekking
d5ab331d8a dnskey is now a property of Key class
After a rebase, the dnskey() invocations need to be adjusted to
accomodate for !11201 (0bf20f8d).

(cherry picked from commit a91f13cae8)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
96cff3c001 Update misleading comments in multisigner test
We are not actually retrieving these records from the other provider,
they are available as key files to us and we are using those files
to send a dynamic update to the server.

(cherry picked from commit 11578aa219)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
a8a080f6f6 Remove common kasp shell script
No system test is using the common kasp shell script test anymore, so we
can remove it.

(cherry picked from commit 61d1209c31)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
58f7bbdf6c Clean up shell script remnants
All the cases in this system test have been converted to pytest, so
we can clean up the shell script remnants.

(cherry picked from commit 97b38a1fbc)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
9379d4f1df Convert model2.secondary test to pytest
This test is similar to model2.multisigner, but now the two providers
are both secondary, both using the same hidden primary. The DNSKEY,
CDNSKEY, and CDS records need to be published at the hidden primary,
ns5, the zone is transferred to both secondaries, ns3 and ns4.

To avoid intermittent test failures, we wait for the line
"zone {zone}/IN (signed): serial {serial2} (unsigned {serial1})" in
the secondary server logs. This is a signal that the unsigned zone
with serial <serial1> has a signed version ready with serial <serial2>.

To speed up the test, disable 'notify-delay'.

(cherry picked from commit c96f896482)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
dc0ac0ca0a Update multisigner system test to set primary
When testing multi-signer as bump-in-the-wire (upcoming test), we want
to be able to do dynamically updates to a hidden primary. Update the
test functions such that we can set a specific primary server.

(cherry picked from commit fdf8a171c5)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
941cd55010 Make test code flexible for more providers
The initial test code only allowed for one additional provider. Update
the test function such that more extra keys can be tested.

(cherry picked from commit 9ae449afd1)
2025-11-28 16:26:39 +00:00
Matthijs Mekking
bdf983b72c Convert model2.multisigner test to pytest
This converts the model2.multisigner tests from the multisigner system
test to pytest based code. Crappy shell test functions such as
'zsks_are_published', 'records_published' and others are replaced with
the standard test code from isctest.kasp and by setting 'private=False'
and 'legacy=True' on the keys from the other providers so we don't do
any key file testing.

(cherry picked from commit 773ce8d99b)
2025-11-28 16:26:39 +00:00
Colin Vidal
628a295f3e fix unitiailized pointer check on getipandkeylist
Function `named_config_getipandkeylist` could, in case of error in the
early code attempting to get the `port` or `tls-port`, make a pointer
check on a non-initialized value. This is now fixed.

(cherry picked from commit 954503b9f5)
2025-11-28 15:38:18 +01:00