Commit graph

125 commits

Author SHA1 Message Date
Michal Nowak
bcb931f4a8
Limit X-Bloat header size to 100KB
Otherwise curl 8.13 rejects the line with:

    I:Check HTTP/1.1 keep-alive with truncated stream (21)
    curl: option --header: error encountered when reading a file
    curl: try 'curl --help' or 'curl --manual' for more information

Also, see https://github.com/curl/curl/pull/16572.
2025-03-25 14:14:52 +01:00
Michal Nowak
df7e9f4ac3 Rename have_* marks to with_*
Marks starting with "with" or "without" make more sense linguistically
than those starting with "have" or "have_not".
2025-01-24 08:45:51 +00:00
Nicki Křížek
7c259fe254 Replace clean.sh files with extra_artifacts mark
The artifact lists in clean.sh and extra_artifacts might be slightly
different. The list was updated for each test to reflect the current
state.
2024-11-08 10:54:24 +01:00
Michal Nowak
5929ba0f54
Rework query functions to retry by default 2024-09-12 11:42:22 +02:00
Mark Andrews
d0c8c6d7ef Only configure statistics-channels if supported 2024-09-12 09:21:44 +10:00
Mark Andrews
7de939609b Properly detect when libxml2 or json-c is not available 2024-09-11 20:51:24 +00:00
Nicki Křížek
ec2fc7680a
Allow rerun of unstable statschannel tests under TSAN
The test_traffic_json and test_traffic_xml occasionally fail when
running under TSAN. This happens in CI and is most likely a result of
some instability that doesn't seem to be easily reproduced.
2024-08-19 16:08:48 +02:00
Mark Andrews
0d69afd764 Disable post zone verification for manykeys
As the expiration time is now+1 the RRSIG records may expire before
the verification step happens.
2024-07-31 03:32:14 +00:00
Tom Krizek
41cb553bdd
Move port env vars into isctest.vars.ports module
The fixture for port assignment isn't needed, replace it with the common
way of handling environment variables.
2024-05-09 17:08:10 +02:00
Aram Sargsyan
e3557f8661 Add a check for the 'first refresh' data in rndc status
Check that 'rndc status' correctly indicates the expected number
of the secondary zones which have the 'first refresh' flag set.
2024-02-05 17:41:14 +00:00
Aram Sargsyan
0b6ee6b953 Add a check for the 'first refresh' data in the stats channel
Currently we test the incoming zone transfers data in the statistics
channel by retransfering the zones in slow mode and capturing the XML
and JSON outputs in the meantime to check their validity. Add a new
transfer to the test, and check that the XML and JSON files correctly
indicate that we have 3 retransfers and 1 new (first time) transfer.
2024-02-05 17:41:14 +00:00
Tom Krizek
f314f1b432
Move custom pytest markers into isctest module
Keep our pytest code more organized by moving the shared code for custom
pytest markers into a dedicated isctest/mark.py module.
2024-01-10 14:57:13 +01:00
Mark Andrews
882b1a4449 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence
2024-01-03 12:09:12 +11:00
Aram Sargsyan
4e94ff2541 Fix a statschannel system test zone loadtime issue
The check_loaded() function compares the zone's loadtime value and
an expected loadtime value, which is based on the zone file's mtime
extracted from the filesystem.

For the secondary zones there may be cases, when the zone file isn't
ready yet before the zone transfer is complete and the zone file is
dumped to the disk, so a so zero value mtime is retrieved.

In such cases wait one second and retry until timeout. Also modify
the affected check to allow a possible difference of the same amount
of seconds as the chosen timeout value.
2023-12-18 08:46:31 +00:00
Tom Krizek
5de2b07daa
Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.
2023-12-05 13:26:49 +01:00
Tom Krizek
f0481c8600
Simplify statsport fixture in statschannel test
The ports fixture provides the required port numbers already and there's
no need to get the port number from environment.
2023-12-05 13:26:49 +01:00
Tom Krizek
a57af8163a
Allow assertion message rewrite in statschannel test
By default, the useful assertion message rewrite is used by pytest for
test modules only. Since another module is imported with shared
functionality, ensure it has pytest's assertion message rewriting
enabled to obtain more debug information in case it fails.
2023-12-05 13:26:49 +01:00
Tom Krizek
fc295b2b5d
Move helper functions in statchannel into single file
Since dnspython is now a required dependency, there's no need to keep
these two helper files separate.
2023-12-05 13:26:49 +01:00
Tom Krizek
1e181cf61d
Remove -U 4 from system tests
This option doesn't appear to be needed for any of the tests, so remove
it to keep things simple.
2023-12-01 14:03:35 +01:00
Evan Hunt
9643281453 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.
2023-11-15 17:23:25 -08:00
Ondřej Surý
f8e264ba6d
Remove the lock-file configuration and -X argument to named
The lock-file configuration (both from configuration file and -X
argument to named) has better alternatives nowadays.  Modern process
supervisor should be used to ensure that a single named process is
running on a given configuration.

Alternatively, it's possible to wrap the named with flock(1).
2023-10-26 22:42:37 +02:00
Tom Krizek
4cb8b13987
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)
2023-10-26 10:23:50 +02:00
Aram Sargsyan
39f46b8ca4 Make the statschannel system test portable
The usage of the newline in the replacement part of the 'sed' call
works in GNU systems, but not in OpenBSD. Use 'awk' instead.

Also use the extended syntax of regular expressions for 'grep', which
is similarly more portable across the supported systems.
2023-10-12 08:37:15 +00:00
Aram Sargsyan
621a1461d9 xfrin: rename XFRST_INITIALSOA to XFRST_ZONEXFRREQUEST
The XFRST_INITIALSOA state in the xfrin module is named like that,
because the first RR in a zone transfer must be SOA. However, the
name of the state is a bit confusing (especially when exposed to
the users with statistics channel), because it can be mistaken with
the refresh SOA request step, which takes place before the zone
transfer starts.

Rename the state to XFRST_ZONEXFRREQUEST (i.e. Zone Transfer Request).
During that step the state machine performs several operations -
establishing a connection, sending a request, and receiving/parsing
the first RR in the answer.
2023-09-22 11:47:26 +00:00
Aram Sargsyan
e92d1eeafc Check zone transfer transports in the statistics channel
Add two more secondary zones to ns3 to be transferred from ns1,
using its IPv6 address for which the 'tcp-only' is set to 'yes'.
Check the statistics channel's incoming zone transfers information
to confirm that the expected transports were used for each of the
SOA query cases (UDP, TCP, TLS), and also for zone transfers (TCP,
TLS).
2023-09-22 09:56:33 +00:00
Mark Andrews
a60e6837fb Wait for slow zone transfer to complete before ending test
This allows the statistics channel to be viewed in a browser while
the transfer is in progress.  Also set the transfer format to
one-answer to extend the amount of time the re-transfer takes.

When running the statschannel test on its own, use
<http://10.53.0.3:5304/xml/v3/xfrins> to see the output.

Note: the port is subject to future change.
2023-09-22 08:52:13 +00:00
Aram Sargsyan
c929127b73 Add a test case for checking zone transfers in statschannel
Use the named -T transferslowly test options to slow down a zone
transfer from the primary server, and test that it's correctly
exposed in the statistics channel of the secondary server, while
it's in-progress.
2023-09-22 08:51:45 +00:00
Tom Krizek
27281955af
Use prereq.sh for statschannel system test 2023-09-19 14:47:48 +02:00
Tom Krizek
168dba163c
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.
2023-09-19 13:29:27 +02:00
Michal Nowak
f0c37d861c
Disable command tracing in statschannel system test
Command tracing was added recently via
26e10e8fb5 and makes the system test too
verbose.
2023-09-05 19:01:27 +02:00
Tom Krizek
7522583b57
Disable loadtime check in statschannel test
It is better to disable the specific check that causes the test to fail
rather than mark the entire test as xfail, which can mask other issues
which the test is capable of detecting.
2023-08-23 14:06:20 +02:00
Tony Finch
26e10e8fb5
Parse statschannel Content-Length: more carefully
A negative or excessively large Content-Length could cause a crash
by making `INSIST(httpd->consume != 0)` fail.
2023-08-21 14:14:18 +02:00
Mark Andrews
7da47fd858 Remove bind9.xsl.1, bind9.xsl.2 and bind9.xsl.3 2023-08-15 10:34:19 +10:00
Tony Finch
b22c87ca61
Fix a stack buffer overflow in the statistics channel
A long timestamp in an If-Modified-Since header could overflow a
fixed-size buffer.
2023-08-14 11:30:24 +02:00
Matthijs Mekking
bbfdcc36c8 Add inline-signing to dnssec-policy
Add an option to enable/disable inline-signing inside the
dnssec-policy clause. The existing inline-signing option that is
set in the zone clause takes priority, but if it is omitted, then the
value that is set in dnssec-policy is taken.

The built-in policies use inline-signing.

This means that if you want to use the default policy without
inline-signing you either have to set it explicitly in the zone
clause:

    zone "example" {
        ...
        dnssec-policy default;
        inline-signing no;
    };

Or create a new policy, only overriding the inline-signing option:

    dnssec-policy "default-dynamic" {
        inline-signing no;
    };

    zone "example" {
        ...
        dnssec-policy default-dynamic;
    };

This also means that if you are going insecure with a dynamic zone,
the built-in "insecure" policy needs to be accompanied with
"inline-signing no;".
2023-08-01 06:55:48 +00:00
Matthijs Mekking
49358928b3 Update statschannel system test
Change test configuration to make use of 'dnssec-policy' instead of
'auto-dnssec'.

Because we now add a DNSKEY with dynamic update, the sign statistics
change. When adding signatures triggered by dynamic update, the
dnssec-refresh stats are not incremented (this is only incremented
when signing is triggered by resign in lib/dns/zone.c).
2023-07-20 11:04:23 +02:00
Aram Sargsyan
aa7538fd38 Fix a bug in an utility script for the statschannel system test
Because of a typo, the fetch.pl script tries to extract the server
address from the input parameter 'a' instead of 's'. Fix the typo.
2023-07-19 13:23:40 +00:00
Tom Krizek
05baf7206b
Use $(...) notation for subshells in system tests
The changes were mostly done with sed:

find . -name '*.sh' | xargs sed -i 's/`\([^`]*\)`/$(\1)/g'

There have been a few manual changes where the regex wasn't sufficient
(e.g. backslashes inside the `...`) or wrong (`...` referring to docs or
in comments).
2023-07-14 15:49:18 +02:00
Tom Krizek
cde02fdb6a
Handle non-zero return codes in statschannel test 2023-07-14 15:49:17 +02:00
Tom Krizek
837c190d9e
Make $? compatible with set -e in system tests
Ensure handling of return code from previous command doesn't cause the
script to halt if that code is non-zero when running with `set -e`.
2023-07-14 15:49:15 +02:00
Tom Krizek
01bc805f89
Run system tests with set -e
Ensure all shell system tests are executed with the errexit option set.
This prevents unchecked return codes from commands in the test from
interfering with the tests, since any failures need to be handled
explicitly.
2023-07-14 15:07:25 +02:00
Evan Hunt
0b09ee8cdc explicitly set dnssec-validation in system tests
the default value of dnssec-validation is 'auto', which causes
a server to send a key refresh query to the root zone when starting
up. this is undesirable behavior in system tests, so this commit
sets dnssec-validation to either 'yes' or 'no' in all tests where
it had not previously been set.

this change had the mostly-harmless side effect of changing the cached
trust level of unvalidated answer data from 'answer' to 'authanswer',
which caused a few test cases in which dumped cache data was examined in
the serve-stale system test to fail. those test cases have now been
updated to expect 'authanswer'.
2023-06-26 13:41:56 -07:00
Tony Finch
e18ca83a3b Improve statschannel HTTP Connection: header protocol conformance
In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response
in a connection should include a `Connection: close` header, but the
statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a
`Connection: keep-alive` header when it is about to close the
connection. There are two ways:

If the first request on a connection is keep-alive and the second
request is not, then _both_ responses have `Connection: keep-alive`
but the connection is (correctly) closed after the second response.

If a single request contains

	Connection: close
	Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but
the statschannel sends a spurious keep-alive in its response, though
it correctly closes the connection.

To fix these bugs, make it more clear that the `httpd->flags` are part
of the per-request-response state. The Connection: flags are now
described in terms of the effect they have instead of what causes them
to be set.
2023-06-15 17:03:09 +01:00
Tom Krizek
087a9b3c97
Mark selected statschannel tests as xfail
The test_zone_timers_secondary_json() and
test_zone_timers_secondary_xml() tests are affected by issue #3983. Due
to the way tests are run, they are only affected when executing them
with the pytest runner.

Strict mode is set for pytest runner, as it always fails there. The
strict mode ensures we'll catch the change when the it starts passing
once the underlying issue is fixed. It can't be set for the legacy
runner, since the test (incorrectly) passes there.

Related #3983
2023-05-22 14:11:40 +02:00
Tom Krizek
2f5bf6d971
Add pytest functions for shell system tests
In order to run the shell system tests, the pytest runner has to pick
them up somehow. Adding an extra python file with a single function
for the shell tests for each system test proved to be the most
compatible way of running the shell tests across older pytest/xdist
versions.

Modify the legacy run.sh script to ignore these pytest-runner specific
glue files when executing tests written in pytest.
2023-05-22 14:11:39 +02:00
Michal Nowak
3cd2cc6254
Adapt to Python scripts to black 23.1.0 2023-02-17 15:31:52 +01:00
Ondřej Surý
971df0b4ed Remove malloced and maxmalloced memory counter
The malloced and maxmalloced memory counters were mostly useless since
we removed the internal allocator blocks - it would only differ from
inuse by the memory context size itself.
2023-01-24 17:57:16 +00:00
Tom Krizek
f6409ee6ac
Use common name convention for pytest files
It is better to use consistent file names to avoid issue with sorting
etc.

Using underscore in filenames as opposed to dash was chosen because it
seems more common in pytest/python to use underscore for filenames.

Also rename the bin/tests/system/timeouts/tests-tcp.py file to
bin/tests/system/timeouts/tests_tcp_timeouts.py to avoid pytest name
collision (there can't be two files named tests_tcp.py).
2022-12-21 13:40:09 +01:00
Tom Krizek
9730ac4c56
Use feature-test feature detection in pytests
Avoid using the environment variables for feature detection and use the
feature-test utility instead.

Remove the obsolete environment variables from conf.sh, since they're no
longer used anywhere.
2022-12-02 10:23:52 +01:00
Tom Krizek
d24fb1122e
Use feature-test to detect feature support in system tests
Previously, there were two different ways to detect feature support.
Either through an environment variable set by configure in conf.sh, or
using the feature-test utility.

It is more simple and consistent to have only one way of detecting the
feature support. Using the feature-test utility seems superior the the
environment variables set by configure.
2022-12-02 10:23:51 +01:00