2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Merge branch 'mnowak/pytest_rewrite_limits' into 'main'

Rewrite limits system test to pytest

See merge request isc-projects/bind9!8798
This commit is contained in:
Michal Nowak 2024-03-18 15:32:47 +00:00
commit db272a4968
10 changed files with 143 additions and 14369 deletions

View File

@ -14,7 +14,6 @@
#
# Clean up after limits tests.
#
rm -f dig.out.*
rm -f */named.memstats
rm -f */named.conf
rm -f */named.run

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19019,94 +19019,94 @@ a-maximum-rrset A 10.0.0.0
A 10.0.15.157
A 10.0.15.158
A 10.0.15.159
A 10.1.0.0
A 10.1.0.1
A 10.1.0.2
A 10.1.0.3
A 10.1.0.4
A 10.1.0.5
A 10.1.0.6
A 10.1.0.7
A 10.1.0.8
A 10.1.0.9
A 10.1.0.10
A 10.1.0.11
A 10.1.0.12
A 10.1.0.13
A 10.1.0.14
A 10.1.0.15
A 10.1.0.16
A 10.1.0.17
A 10.1.0.18
A 10.1.0.19
A 10.1.0.20
A 10.1.0.21
A 10.1.0.22
A 10.1.0.23
A 10.1.0.24
A 10.1.0.25
A 10.1.0.26
A 10.1.0.27
A 10.1.0.28
A 10.1.0.29
A 10.1.0.30
A 10.1.0.31
A 10.1.0.32
A 10.1.0.33
A 10.1.0.34
A 10.1.0.35
A 10.1.0.36
A 10.1.0.37
A 10.1.0.38
A 10.1.0.39
A 10.1.0.40
A 10.1.0.41
A 10.1.0.42
A 10.1.0.43
A 10.1.0.44
A 10.1.0.45
A 10.1.0.46
A 10.1.0.47
A 10.1.0.48
A 10.1.0.49
A 10.1.0.50
A 10.1.0.51
A 10.1.0.52
A 10.1.0.53
A 10.1.0.54
A 10.1.0.55
A 10.1.0.56
A 10.1.0.57
A 10.1.0.58
A 10.1.0.59
A 10.1.0.60
A 10.1.0.61
A 10.1.0.62
A 10.1.0.63
A 10.1.0.64
A 10.1.0.65
A 10.1.0.66
A 10.1.0.67
A 10.1.0.68
A 10.1.0.69
A 10.1.0.70
A 10.1.0.71
A 10.1.0.72
A 10.1.0.73
A 10.1.0.74
A 10.1.0.75
A 10.1.0.76
A 10.1.0.77
A 10.1.0.78
A 10.1.0.79
A 10.1.0.80
A 10.1.0.81
A 10.1.0.82
A 10.1.0.83
A 10.1.0.84
A 10.1.0.85
A 10.1.0.86
A 10.1.0.87
A 10.1.0.88
A 10.1.0.89
A 10.1.0.90
A 10.0.15.160
A 10.0.15.161
A 10.0.15.162
A 10.0.15.163
A 10.0.15.164
A 10.0.15.165
A 10.0.15.166
A 10.0.15.167
A 10.0.15.168
A 10.0.15.169
A 10.0.15.170
A 10.0.15.171
A 10.0.15.172
A 10.0.15.173
A 10.0.15.174
A 10.0.15.175
A 10.0.15.176
A 10.0.15.177
A 10.0.15.178
A 10.0.15.179
A 10.0.15.180
A 10.0.15.181
A 10.0.15.182
A 10.0.15.183
A 10.0.15.184
A 10.0.15.185
A 10.0.15.186
A 10.0.15.187
A 10.0.15.188
A 10.0.15.189
A 10.0.15.190
A 10.0.15.191
A 10.0.15.192
A 10.0.15.193
A 10.0.15.194
A 10.0.15.195
A 10.0.15.196
A 10.0.15.197
A 10.0.15.198
A 10.0.15.199
A 10.0.15.200
A 10.0.15.201
A 10.0.15.202
A 10.0.15.203
A 10.0.15.204
A 10.0.15.205
A 10.0.15.206
A 10.0.15.207
A 10.0.15.208
A 10.0.15.209
A 10.0.15.210
A 10.0.15.211
A 10.0.15.212
A 10.0.15.213
A 10.0.15.214
A 10.0.15.215
A 10.0.15.216
A 10.0.15.217
A 10.0.15.218
A 10.0.15.219
A 10.0.15.220
A 10.0.15.221
A 10.0.15.222
A 10.0.15.223
A 10.0.15.224
A 10.0.15.225
A 10.0.15.226
A 10.0.15.227
A 10.0.15.228
A 10.0.15.229
A 10.0.15.230
A 10.0.15.231
A 10.0.15.232
A 10.0.15.233
A 10.0.15.234
A 10.0.15.235
A 10.0.15.236
A 10.0.15.237
A 10.0.15.238
A 10.0.15.239
A 10.0.15.240
A 10.0.15.241
A 10.0.15.242
A 10.0.15.243
A 10.0.15.244
A 10.0.15.245
A 10.0.15.246
A 10.0.15.247
A 10.0.15.248
A 10.0.15.249
A 10.0.15.250

View File

@ -1,57 +0,0 @@
#!/bin/sh
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
set -e
. ../conf.sh
DIGOPTS="-p ${PORT}"
status=0
echo_i "1000 A records"
$DIG $DIGOPTS +tcp +norec 1000.example. @10.53.0.1 a >dig.out.1000 || status=1
# $DIG $DIGOPTS 1000.example. @10.53.0.1 a > knowngood.dig.out.1000
digcomp knowngood.dig.out.1000 dig.out.1000 || status=1
echo_i "2000 A records"
$DIG $DIGOPTS +tcp +norec 2000.example. @10.53.0.1 a >dig.out.2000 || status=1
# $DIG $DIGOPTS 2000.example. @10.53.0.1 a > knowngood.dig.out.2000
digcomp knowngood.dig.out.2000 dig.out.2000 || status=1
echo_i "3000 A records"
$DIG $DIGOPTS +tcp +norec 3000.example. @10.53.0.1 a >dig.out.3000 || status=1
# $DIG $DIGOPTS 3000.example. @10.53.0.1 a > knowngood.dig.out.3000
digcomp knowngood.dig.out.3000 dig.out.3000 || status=1
echo_i "4000 A records"
$DIG $DIGOPTS +tcp +norec 4000.example. @10.53.0.1 a >dig.out.4000 || status=1
# $DIG $DIGOPTS 4000.example. @10.53.0.1 a > knowngood.dig.out.4000
digcomp knowngood.dig.out.4000 dig.out.4000 || status=1
echo_i "exactly maximum rrset"
$DIG $DIGOPTS +tcp +norec +noedns a-maximum-rrset.example. @10.53.0.1 a >dig.out.a-maximum-rrset \
|| status=1
# $DIG $DIGOPTS a-maximum-rrset.example. @10.53.0.1 a > knowngood.dig.out.a-maximum-rrset
digcomp knowngood.dig.out.a-maximum-rrset dig.out.a-maximum-rrset || status=1
echo_i "exceed maximum rrset (5000 A records)"
$DIG $DIGOPTS +tcp +norec +noadd 5000.example. @10.53.0.1 a >dig.out.exceed || status=1
# Look for truncation bit (tc).
grep 'flags: .*tc.*;' dig.out.exceed >/dev/null || {
echo_i "TC bit was not set"
status=1
}
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1

View File

@ -0,0 +1,52 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import itertools
import isctest
import pytest
import dns.message
# Everything from getting a big answer to creating an RR set with thousands
# of records takes minutes of CPU and real time with dnspython < 2.0.0.
pytest.importorskip("dns", minversion="2.0.0")
@pytest.mark.parametrize(
"name,limit",
[
("1000", 1000),
("2000", 2000),
("3000", 3000),
("4000", 4000),
("a-maximum-rrset", 4091),
],
)
def test_limits(name, limit):
msg_query = dns.message.make_query(f"{name}.example.", "A")
res = isctest.query.tcp(msg_query, "10.53.0.1")
iplist = [
f"10.0.{x}.{y}"
for x, y in itertools.islice(itertools.product(range(256), repeat=2), limit)
]
msg_rrset = [dns.rrset.from_text_list(f"{name}.example.", "5M", "IN", "A", iplist)]
assert res.answer == msg_rrset
def test_limit_exceeded():
msg_query = dns.message.make_query("5000.example.", "A")
res = isctest.query.tcp(msg_query, "10.53.0.1")
assert res.flags & dns.flags.TC, "TC flag was not set"

View File

@ -1,14 +0,0 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
def test_limits(run_tests_sh):
run_tests_sh()