summaryrefslogtreecommitdiffstats
path: root/bin/tests/system/stress
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:59:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:59:48 +0000
commit3b9b6d0b8e7f798023c9d109c490449d528fde80 (patch)
tree2e1c188dd7b8d7475cd163de9ae02c428343669b /bin/tests/system/stress
parentInitial commit. (diff)
downloadbind9-3b9b6d0b8e7f798023c9d109c490449d528fde80.tar.xz
bind9-3b9b6d0b8e7f798023c9d109c490449d528fde80.zip
Adding upstream version 1:9.18.19.upstream/1%9.18.19
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/tests/system/stress')
-rw-r--r--bin/tests/system/stress/clean.sh22
-rw-r--r--bin/tests/system/stress/ns2/named.conf.in57
-rw-r--r--bin/tests/system/stress/ns2/zone.template.db21
-rw-r--r--bin/tests/system/stress/ns3/named.conf.in74
-rw-r--r--bin/tests/system/stress/ns4/named.conf.in57
-rw-r--r--bin/tests/system/stress/setup.sh25
-rw-r--r--bin/tests/system/stress/tests_stress_update.py79
7 files changed, 335 insertions, 0 deletions
diff --git a/bin/tests/system/stress/clean.sh b/bin/tests/system/stress/clean.sh
new file mode 100644
index 0000000..4833fa7
--- /dev/null
+++ b/bin/tests/system/stress/clean.sh
@@ -0,0 +1,22 @@
+#!/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.
+
+rm -f ns?/zone*.bk
+
+rm -f ns2/zone0*.db
+rm -f ns2/zone0*.jnl
+rm -f */named.memstats
+rm -f ns*/named.lock
+rm -f ns*/managed-keys.bind*
+rm -f ns*/named.run
+rm -f ns*/named.conf
diff --git a/bin/tests/system/stress/ns2/named.conf.in b/bin/tests/system/stress/ns2/named.conf.in
new file mode 100644
index 0000000..607e0b5
--- /dev/null
+++ b/bin/tests/system/stress/ns2/named.conf.in
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+controls { /* empty */ };
+
+options {
+ query-source address 10.53.0.2;
+ notify-source 10.53.0.2;
+ transfer-source 10.53.0.2;
+ port @PORT@;
+ pid-file "named.pid";
+ listen-on { 10.53.0.2; };
+ listen-on-v6 { none; };
+ recursion no;
+ dnssec-validation no;
+ notify yes;
+};
+
+zone "zone000000.example" {
+ type primary;
+ allow-update { any; };
+ file "zone000000.example.db";
+};
+
+zone "zone000001.example" {
+ type primary;
+ allow-update { any; };
+ file "zone000001.example.db";
+};
+
+zone "zone000002.example" {
+ type primary;
+ allow-update { any; };
+ file "zone000002.example.db";
+};
+
+zone "zone000003.example" {
+ type primary;
+ allow-update { any; };
+ file "zone000003.example.db";
+};
+
+zone "zone000004.example" {
+ type primary;
+ allow-update { any; };
+ file "zone000004.example.db";
+};
diff --git a/bin/tests/system/stress/ns2/zone.template.db b/bin/tests/system/stress/ns2/zone.template.db
new file mode 100644
index 0000000..7ca1cc3
--- /dev/null
+++ b/bin/tests/system/stress/ns2/zone.template.db
@@ -0,0 +1,21 @@
+; 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.
+
+$TTL 300
+@ IN SOA ns2 hostmaster 1 300 120 3600 86400
+@ NS ns2
+ NS ns3
+ NS ns4
+ns2 A 10.53.0.2
+ns3 A 10.53.0.3
+ns4 A 10.53.0.4
+
+$GENERATE 0-999 name${0,6} A 10.0.0.1
diff --git a/bin/tests/system/stress/ns3/named.conf.in b/bin/tests/system/stress/ns3/named.conf.in
new file mode 100644
index 0000000..13e54a5
--- /dev/null
+++ b/bin/tests/system/stress/ns3/named.conf.in
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+controls { /* empty */ };
+
+options {
+ query-source address 10.53.0.3;
+ notify-source 10.53.0.3;
+ transfer-source 10.53.0.3;
+ port @PORT@;
+ pid-file "named.pid";
+ listen-on { 10.53.0.3; };
+ listen-on-v6 { none; };
+ recursion yes;
+ dnssec-validation yes;
+ notify yes;
+};
+
+key rndc_key {
+ secret "1234abcd8765";
+ algorithm @DEFAULT_HMAC@;
+};
+
+controls {
+ inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
+};
+
+server 10.53.0.4 {
+ provide-ixfr no;
+};
+
+server 10.53.0.2 {
+ request-ixfr no;
+};
+
+zone "zone000000.example" {
+ type secondary;
+ file "zone000000.example.bk";
+ primaries { 10.53.0.2; };
+};
+
+zone "zone000001.example" {
+ type secondary;
+ file "zone000001.example.bk";
+ primaries { 10.53.0.2; };
+};
+
+zone "zone000002.example" {
+ type secondary;
+ file "zone000002.example.bk";
+ primaries { 10.53.0.2; };
+};
+
+zone "zone000003.example" {
+ type secondary;
+ file "zone000003.example.bk";
+ primaries { 10.53.0.2; };
+};
+
+zone "zone000004.example" {
+ type secondary;
+ file "zone000004.example.bk";
+ primaries { 10.53.0.2; };
+};
diff --git a/bin/tests/system/stress/ns4/named.conf.in b/bin/tests/system/stress/ns4/named.conf.in
new file mode 100644
index 0000000..26296f5
--- /dev/null
+++ b/bin/tests/system/stress/ns4/named.conf.in
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+controls { /* empty */ };
+
+options {
+ query-source address 10.53.0.4;
+ notify-source 10.53.0.4;
+ transfer-source 10.53.0.4;
+ port @PORT@;
+ pid-file "named.pid";
+ listen-on { 10.53.0.4; };
+ listen-on-v6 { none; };
+ recursion yes;
+ dnssec-validation yes;
+ notify yes;
+};
+
+zone "zone000000.example" {
+ type secondary;
+ file "zone000000.example.bk";
+ primaries { 10.53.0.3; };
+};
+
+zone "zone000001.example" {
+ type secondary;
+ file "zone000001.example.bk";
+ primaries { 10.53.0.3; };
+};
+
+zone "zone000002.example" {
+ type secondary;
+ file "zone000002.example.bk";
+ primaries { 10.53.0.3; };
+};
+
+zone "zone000003.example" {
+ type secondary;
+ file "zone000003.example.bk";
+ primaries { 10.53.0.3; };
+};
+
+zone "zone000004.example" {
+ type secondary;
+ file "zone000004.example.bk";
+ primaries { 10.53.0.3; };
+};
diff --git a/bin/tests/system/stress/setup.sh b/bin/tests/system/stress/setup.sh
new file mode 100644
index 0000000..aab7002
--- /dev/null
+++ b/bin/tests/system/stress/setup.sh
@@ -0,0 +1,25 @@
+#!/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.
+
+# shellcheck source=conf.sh
+. ../conf.sh
+
+cp ns2/zone.template.db ns2/zone000000.example.db
+cp ns2/zone.template.db ns2/zone000001.example.db
+cp ns2/zone.template.db ns2/zone000002.example.db
+cp ns2/zone.template.db ns2/zone000003.example.db
+cp ns2/zone.template.db ns2/zone000004.example.db
+
+copy_setports ns2/named.conf.in ns2/named.conf
+copy_setports ns3/named.conf.in ns3/named.conf
+copy_setports ns4/named.conf.in ns4/named.conf
diff --git a/bin/tests/system/stress/tests_stress_update.py b/bin/tests/system/stress/tests_stress_update.py
new file mode 100644
index 0000000..d326f14
--- /dev/null
+++ b/bin/tests/system/stress/tests_stress_update.py
@@ -0,0 +1,79 @@
+# 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 concurrent.futures
+import os
+import subprocess
+import time
+import dns.query
+import dns.update
+
+
+def rndc_loop(test_state, server):
+ rndc = os.getenv("RNDC")
+ port = os.getenv("CONTROLPORT")
+
+ cmdline = [
+ rndc,
+ "-c",
+ "../common/rndc.conf",
+ "-p",
+ port,
+ "-s",
+ server,
+ "reload",
+ ]
+
+ while not test_state["finished"]:
+ subprocess.run(cmdline, check=False)
+ time.sleep(1)
+
+
+def update_zone(test_state, zone, named_port, logger):
+ server = "10.53.0.2"
+ for i in range(1000):
+ if test_state["finished"]:
+ return
+ update = dns.update.UpdateMessage(zone)
+ update.add(f"dynamic-{i}.{zone}", 300, "TXT", f"txt-{i}")
+ try:
+ response = dns.query.udp(update, server, 10, named_port)
+ assert response.rcode() == dns.rcode.NOERROR
+ except dns.exception.Timeout:
+ logger.info(f"error: query timeout for {zone}")
+
+ logger.info(f"Update of {server} zone {zone} successful")
+
+
+# If the test has run to completion without named crashing, it has succeeded.
+def test_update_stress(named_port, logger):
+ test_state = {"finished": False}
+
+ with concurrent.futures.ThreadPoolExecutor() as executor:
+ executor.submit(rndc_loop, test_state, "10.53.0.3")
+
+ updaters = []
+ for i in range(5):
+ zone = f"zone00000{i}.example."
+ updaters.append(
+ executor.submit(update_zone, test_state, zone, named_port, logger)
+ )
+
+ # All the update_zone() tasks are expected to complete within 5
+ # minutes. If they do not, we cannot assert immediately as that will
+ # cause the ThreadPoolExecutor context manager to wait indefinitely;
+ # instead, we first signal all tasks that it is time to exit and only
+ # check whether any task failed to finish within 5 minutes outside of
+ # the ThreadPoolExecutor context manager.
+ unfinished_tasks = concurrent.futures.wait(updaters, timeout=300).not_done
+ test_state["finished"] = True
+
+ assert not unfinished_tasks