Commit Graph
3940 Commits
Author SHA1 Message Date
Diego FronzaandMichał Kępień 89129a3a85 Fix resolver tests: prefetch 40/41
These two tests were failing basically because in order for prefetching to
happen, the TTL for a given DNS record must be greater than or equal to
the prefetch config value + 9.

The previous TTL for both records was 10, while prefetch value in
configuration was 3, thus making only records with TTL >= 12 elligible
for prefetching.

TTL value for both records was adjusted to the value 13, and prefetch
value was set to 4 (inc by 1), so records with TTL (4 + 9) >= 13 are
elligible for prefetching.

Adjusting prefetch value to 4 gives the test 1 second more to avoid time
problems when sharing resources on a heavy loaded PC.

Also prefetch value in settings is now read by the script and used
by it to corrrectly calculate the amount of time needed to delay before
sending a request to trigger prefetch, adding a bit of flexibility to
fine tune the test in the future.

(cherry picked from commit a711d6f8c0)
2020-01-09 11:44:44 +01:00
Diego FronzaandMichał Kępień f06c1dde90 Fix resolver test: prefetch disabled
The previous test had two problems:
1. It wasn't written specifically for testing what it was supposed to:
prefetch disabled.
2. It could fail in some circunstances if the computer's load is too
high, due to sleeps not taking parallel tests and cpu load into account.

The new test is testing prefetch disabled as follows:
1. It asks for a txt record for a given domain and takes note of the
record's TTL (which is 10).
2. It sleeps for (TTL - 5) = 5 seconds, having a window of 5 seconds to
issue new queries before the record expires from cache.
3. Three(3) queries are executed in a row, with a interval of 1 second
between them, and for each query we verify that the TTL in response is
less than the previous one, thus ensuring that prefetch is disabled (if
it were enabled this record would have been refreshed already and TTL
would be >= the first TTL).

Having a window of 5 seconds to perform 3 queries with a interval of 1
second between them gives the test a reasonable amount of time
to not suffer from a machine with heavy load.

(cherry picked from commit dd524cc893)
2020-01-09 11:32:38 +01:00
Mark AndrewsandMichał Kępień ab9e50e683 Increase wait_for_message attempts to 20.
(cherry picked from commit 4dd9ec8919)
2020-01-09 10:47:16 +01:00
Mark AndrewsandMichał Kępień de942601fe save wait_for_message contents
(cherry picked from commit 1334daaec0)
2020-01-09 10:47:16 +01:00
Ondřej SurýandMichał Kępień 2756dff680 Use retry() and nextpart*() to simplify catz test
(cherry picked from commit 51b05189f7)
2020-01-08 15:19:17 +01:00
Witold KręcickiandMichał Kępień 0f2ef0ca34 Fix timing issues in catz test
Make the log checks more precise and use the retry() function for
repeating the checks.

(cherry picked from commit 9b43e65c01)
2020-01-08 15:19:17 +01:00
Michał Kępień 609c7dc79e Implement a "read-only" version of nextpart()
The system test helper function nextpart() always updates the "lines
read so far" marker ("<file>.prev") when it is called, which somewhat
limits its flexibility.  Add two new helper functions, nextpartpeek()
and nextpartreset(), so that certain parts of log files can be easily
examined more than once.  Add some documentation to help understand the
purpose of each function in the nextpart*() family.

(cherry picked from commit facb68b22e)
2020-01-08 15:19:17 +01:00
Michał Kępień 4133648ee0 Only run managed keys tests for builds with crypto 2020-01-08 13:17:10 +01:00
Ondřej SurýandMichał Kępień e2aab0cbf1 Fix multiple issues in named setuid check
(cherry picked from commit 4a6d9ea152)
2020-01-08 13:07:42 +01:00
Evan HuntandMichał Kępień e6d99c2d4e fixed a test failure, some other shell cleanup
(cherry picked from commit dc760867d8)
2020-01-08 13:07:42 +01:00
Ondřej SurýandMichał Kępień fbd685b827 Instead of sleeping for a fixed time, wait for named to log specific message in a loop
(cherry picked from commit 355eb0c288)
2020-01-08 13:07:42 +01:00
Ondřej SurýandMichał Kępień e5881bcff1 Make runtime/tests.sh shellcheck and set -e clean
This mostly comprises of:

* changing the directories in subshell and not ignoring `cd` return code
* handling every error gracefully instead of ignoring the return code

(cherry picked from commit 57b6aeabd5)
2020-01-08 13:07:40 +01:00
Ondřej SurýandMichał Kępień 8b23127687 Further improve the runtime tests to look for a specific instead of generic error
(cherry picked from commit d26e7166a6)
2020-01-08 12:51:14 +01:00
Ondřej SurýandMichał Kępień 66f9d83164 Fix couple of no-op tests to actually test something (configuration files were missing)
(cherry picked from commit 60f335204a)
2020-01-08 12:51:14 +01:00
Ondřej SurýandMichał Kępień 28e2528f02 runtime test: make the pidfiles match the names of configuration files
(cherry picked from commit fe021299e0)
2020-01-08 12:51:04 +01:00
Ondřej SurýandMichał Kępień 774da247bd runtime test: use helper function that kills named and waits for the finish
(cherry picked from commit e9d348bac5)
2020-01-08 12:33:02 +01:00
Mark AndrewsandOndřej Surý de560f98a2 Address timing issues in 'inline' system test.
"rndc signing -serial <value>" could take longer than a second to
complete.  Loop waiting for update to succeed.

For tests where "rndc signing -serial <value>" is supposed to not
succeed, repeatedly test that we don't get the new serial, then
test that we have the old value.  This should prevent false negatives.

(cherry picked from commit 13fa80ede8)
2020-01-08 08:32:06 +01:00
Ondřej SurýandMichał Kępień 1007882fee Detect cores on FreeBSD
(cherry picked from commit 38277ddb0b)
2020-01-07 15:59:37 +01:00
Ondřej SurýandMichał Kępień e694c22386 Reduce the minimal numbers of days in jitter test to 5
(cherry picked from commit 4b2911a45a)
2020-01-07 15:53:10 +01:00
Ondřej SurýandMichał Kępień cef4c4f708 Tune the performance of CDS/CDNSKEY deletion test
(cherry picked from commit 76eac9a691)
2020-01-07 15:53:10 +01:00
Ondřej SurýandMichał Kępień 0eab5260fe Tune the performance of oldsigs test
The oldsigs test was checking only for the validity of the A
a.oldsigs.example. resource record and associated DNSSEC signature while
the zone might not have been fully signed yet leading to validation
failures because of bogus signatures on the validation path.

This commit changes the test to test that all old signatures in the
oldsigs.example. zone were replaced and the zone is fully resigned
before running the main check.

(cherry picked from commit 519b047362)
2020-01-07 15:53:07 +01:00
Ondřej SurýandMichał Kępień c76b83c420 Tune the performance of the jitter test
(cherry picked from commit ffb7ae8beb)
2020-01-07 15:50:51 +01:00
Ondřej SurýandMichał Kępień b77d31fa10 Wait a little bit longer for autosign, bail out on not enough categories
(cherry picked from commit f1cbdc5498)
2020-01-07 15:37:54 +01:00
Ondřej SurýandMichał Kępień a40ceb292e Adjust the jitter range to +-3*stddev
(cherry picked from commit d6f68fc4f0)
2020-01-07 15:37:54 +01:00
Ondřej SurýandMichał Kępień 022cb23250 Check if the RRSIG jitter falls into mean+-2.5*stddev range
(cherry picked from commit 0480a95ddf)
2020-01-07 15:34:38 +01:00
Ondřej SurýandMichał Kępień 546f65ffdb Dump the backtrace to stdout when core is found in systest directory
(cherry picked from commit 512dadc8d1)
2020-01-07 14:59:37 +01:00
Michał Kępień ac1267c36a Include prepare-softhsm2.sh in source tarballs
The util/prepare-softhsm2.sh script is useful for initializing a working
SoftHSM environment which can be used by unit tests and system tests.
However, since it is a test-specific script, it does not really belong
in the util/ subdirectory which is mostly pruned during the BIND source
tarball creation process.  Move the prepare-softhsm2.sh script to
bin/tests/ so that its location is more appropriate for its purpose and
also so that it does not get removed during the BIND source tarball
creation process, allowing it to be used for setting up test
environments for tarball-based builds.

(cherry picked from commit c0be772ebc)
2019-12-11 15:13:00 +01:00
Michał Kępień 54b0b051db Only list the "lwresd" system test once on Windows
In bin/tests/system/conf.sh.win32, the "lwresd" system test is
erroneously listed both in SEQUENTIALDIRS and PARALLELDIRS.  Keep it
only in the former to prevent GitLab CI pipelines from consistently
failing on Windows due to SUBDIRS containing a different number of tests
than found in bin/tests/system/systests.output.
2019-12-11 14:29:21 +01:00
Matthijs MekkingandOndřej Surý 6d83b061ab Better error handling in autosign system test
(cherry picked from commit bd4035900a)
(cherry picked from commit 6658c11251)
2019-12-10 13:58:25 +00:00
Matthijs MekkingandOndřej Surý 677ea3aa05 Fix race in autosign test
The autosign test has a test case where a DNSSEC maintaiend zone
has a set of DNSSEC keys without any timing metadata set.  It
tests if named picks up the key for publication and signing if a
delayed dnssec-settime/loadkeys event has occured.

The test failed intermittently despite the fact it sleeps for 5
seconds but the triggered key reconfigure action should happen after
3 seconds.

However, the test output showed that the test query came in before
the key reconfigure action was complete (see excerpts below).

The loadkeys command is received:

15:38:36 received control channel command 'loadkeys delay.example.'

The reconfiguring zone keys action is triggered after 3 seconds:

15:38:39 zone delay.example/IN: reconfiguring zone keys
15:38:39 DNSKEY delay.example/NSEC3RSASHA1/7484 (ZSK) is now published
15:38:39 DNSKEY delay.example/NSEC3RSASHA1/7455 (KSK) is now published
15:38:39 writing to journal

Two seconds later the test query comes in:

15:38:41 client @0x7f1b8c0562b0 10.53.0.1#44177: query
15:38:41 client @0x7f1b8c0562b0 10.53.0.1#44177: endrequest

And 6 more seconds later the reconfigure keys action is complete:

15:38:47 zone delay.example/IN: next key event: 05-Dec-2019 15:48:39

This commit fixes the test by checking the "next key event" log has
been seen before executing the test query, making sure that the
reconfigure keys action has been complete.

This commit however does not fix, nor explain why it took such a long
time (8 seconds) to reconfigure the keys.

(cherry picked from commit 2e4273b55a)
(cherry picked from commit fb0ddd5bfe)
2019-12-10 13:58:24 +00:00
Matthijs MekkingandOndřej Surý f346fbdec9 Introduce wait_for_log in autosign test
(cherry picked from commit 5d6fad9e1e)
2019-12-10 13:58:24 +00:00
Matthijs MekkingandOndřej Surý ff44e1f086 Save settime output
(cherry picked from commit 6b4a17ef7c)
2019-12-10 13:58:24 +00:00
Michał Kępień 367a576f73 Use a different character for invalid U-label test
When libidn2 2.3.0+ is used, the "idna" system test fails as dig does
not fail as expected any more due to libidn2 2.3.0 using Unicode 11.0.0
IDNA mapping tables [1] instead of Unicode 6.3.0 ones which were used
until libidn2 2.2.0.  Specifically, the SOCKS character (🧦) used in the
invalid input U-label check in the "idna" system test is a valid IDNA
character as per the IDNA mapping tables for Unicode 11.0.0.  Fix the
relevant checks by using a different character (🟥) which is an invalid
IDNA character for all versions of Unicode released to date.

[1] https://gitlab.com/libidn/libidn2/commit/5eaafda64e733bfe15f66c8a39fd9bc2753ba8f2
2019-12-10 12:01:49 +01:00
Michał Kępień 6966422bf9 Only use LC_ALL=C where intended
The LC_ALL=C assignments in the "idna" system test, which were only
meant to affect a certain subset of checks, in fact persist throughout
all the subsequent checks in that system test.  That affects the test's
behavior and is misleading.

When the "VARIABLE=value command ..." syntax is used in a shell script,
in order for the variable assignment to only apply to "command", the
latter must be an external binary; otherwise, the VARIABLE=value
assignment persists for all subsequent commands in a script:

    $ cat foo.sh
    #!/bin/sh

    foo() {
        /bin/sh bar.sh
    }

    BAR="baz0"
    BAR="baz1" /bin/sh bar.sh
    echo "foo: BAR=${BAR}"
    BAR="baz2" foo
    echo "foo: BAR=${BAR}"

    $ cat bar.sh
    #!/bin/sh

    echo "bar: BAR=${BAR}"

    $ /bin/sh foo.sh
    bar: BAR=baz1
    foo: BAR=baz0
    bar: BAR=baz2
    foo: BAR=baz2
    $

Fix by saving the value of LC_ALL before the relevant set of checks in
the "idna" system test, restoring it afterwards, and dropping the
"LC_ALL=C command ..." syntax.

(cherry picked from commit 2ee7ff23ce)
2019-12-10 12:01:26 +01:00
Michał Kępień 26213ff696 Automatically run clean.sh from run.sh
The first step in all existing setup.sh scripts is to call clean.sh.  To
reduce code duplication and ensure all system tests added in the future
behave consistently with existing ones, invoke clean.sh from run.sh
before calling setup.sh.

(cherry picked from commit d8905b7a9c)
2019-12-06 15:06:49 +01:00
Michał Kępień ef3a08226c Remove bin/tests/system/clean.sh
Since the role of the bin/tests/system/clean.sh script has now been
reduced to calling a given system test's clean.sh script, remove the
former altogether and replace its only use with a direct invocation of
the latter.

(cherry picked from commit bf3eeac067)
2019-12-06 15:06:49 +01:00
Michał Kępień bc04dbf788 Remove the -r switch from system test scripts
Since files containing system test output are no longer stored in test
subdirectories, bin/tests/system/clean.sh no longer needs to take care
of removing the test.output file for a given test as testsummary.sh
already takes care of that and even if a test suite terminates
abnormally and another one is started, tee invoked without the -a
command line switch overwrites the destination file if it exists, so
leftover test.output.* files from previous test suite runs are not a
concern.  Remove the -r command line switch and the code associated with
it from the relevant scripts.

(cherry picked from commit b4d37878f6)
2019-12-06 15:06:49 +01:00
Michał Kępień cbc56385b2 Store system test output in bin/tests/system/
Some clean.sh scripts contain overly broad file deletion wildcards which
cause the test.output file (used by the system test framework for
collecting output) in a given system test's directory to be erroneously
removed immediately after the test is started (due to setup.sh scripts
calling clean.sh at the beginning).  This prevents the test's output
from being placed in bin/tests/system/systests.output at the end of a
test suite run and thus can lead to test failures being ignored.  Fix by
storing each test's output in a test.output.<test-name> file in
bin/tests/system/, which prevents clean.sh scripts from removing it (as
they should only ever affect files contained in a given system test's
directory).

(cherry picked from commit b0916bba41)
2019-12-06 15:06:49 +01:00
Michał Kępień fef7060935 Detect missing system test results
At the end of each system test suite run, the system test framework
collects all existing test.output files from system test subdirectories
and produces bin/tests/system/systests.output from those files.
However, it does not check whether a test.output file was found for
every executed test.  Thus, if the test.output file is accidentally
deleted by the system test itself (e.g. due to an overly broad file
removal wildcard present in clean.sh), its output will not be included
in bin/tests/system/systests.output.  Since the result of each system
test suite run is determined by bin/tests/system/testsummary.sh, which
only operates on the contents of bin/tests/system/systests.output, this
can lead to test failures being ignored.  Fix by ensuring the number of
test results found in bin/tests/system/systests.output is equal to the
number of tests run and triggering a system test suite failure in case
of a discrepancy between these two values.

(cherry picked from commit 3c3085be3c)
2019-12-06 14:42:13 +01:00
Ondřej SurýandDiego Fronza e50abe8a70 Cleanup the isc_stats code 2019-12-04 19:39:57 -03:00
Michal NowakandOndřej Surý 412edf8982 Verifying that named switches UID
This test runs only under root, which is required for the user-switch
`-u` option to work.

Closes #537.

(cherry picked from commit b00360537e)
2019-11-27 11:52:08 +00:00
Evan Hunt 47da3129fd add a stats counter for clients dropped due to recursive-clients limit
(cherry picked from commit 715afa9c57)
2019-11-26 11:34:23 -08:00
Ondřej Surý f5852f5f81 Add retry_quiet() function to retry quietly for an event to occur
(cherry picked from commit 31264a7e00)
2019-11-26 09:21:39 +01:00
Michał Kępień 87f7838a99 Address ShellCheck warnings
Address all outstanding warnings that ShellCheck reports for
bin/tests/system/tcp/tests.sh.

(cherry picked from commit 23ca0ec55b)
2019-11-19 15:46:55 +01:00
Michał Kępień a390e261ad Use "set -e" in the "tcp" system test
Ensure any unexpected failure in the "tcp" system test causes it to be
immediately interrupted with an error to make the aforementioned test
more reliable.  Since the exit code for "expr 0 + 0" is 1, the status
variable needs to be updated using arithmetic expansion.

(cherry picked from commit 9841635b7f)
2019-11-19 15:46:35 +01:00
Michał Kępień 06705a0ee5 Ensure all "tcp" system test errors are caught
Ensure any "rndc stats" failure causes the "tcp" system test to fail.
Do not hide "rndc stats" output.

(cherry picked from commit 46df363a0d)
2019-11-19 15:46:34 +01:00
Michał Kępień bc498bd6c9 Make all "tcp" system test checks numbered
Ensure all checks in the "tcp" system test are numbered, so that
forensic data is preserved in case of any failure.

(cherry picked from commit 2f4877d11c)
2019-11-19 15:46:04 +01:00
Michał Kępień 01a413cecc Fix argument order in assert_int_equal()
assert_int_equal() calls in bin/tests/system/tcp/tests.sh pass the found
value as the first argument and the expected value as the second
argument, while the function interprets its arguments the other way
round.  Fix argument handling in assert_int_equal() to make sure the
error messages printed by that function are correct.

(cherry picked from commit 6bd1f68bef)
2019-11-19 15:45:07 +01:00
Michał Kępień 3e9781087a Allow retries when checking TCP high-water stats
In the TCP high-water checks, "rndc stats" is run after ans6 reports
that it opened the requested number of TCP connections.  However, we
fail to account for the fact that ns5 might not yet have called accept()
for these connections, in which case the counts output by "rndc stats"
will be off.  To prevent intermittent "tcp" system test failures, allow
the relevant connection count checks to be retried (just once, after one
second, as that should be enough for any system to accept() a dozen TCP
connections under any circumstances).

(cherry picked from commit 1e22e052d0)
2019-11-19 15:43:16 +01:00
Michał Kępień 69697ee680 Add assert_int_equal() shell function
Add a shell function which is used in the "tcp" system test, but has
been accidentally omitted from !2425.  Make sure the function does not
change the value of "ret" itself, so that the caller can decide what to
do with the function's return value.

(cherry picked from commit 8bb7f1f2a1)
2019-11-06 21:07:02 +01:00