]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Convert setup.pl into static configurations
authorMichał Kępień <michal@isc.org>
Tue, 11 Jul 2023 13:56:31 +0000 (15:56 +0200)
committerMichal Nowak <mnowak@isc.org>
Tue, 8 Aug 2023 08:31:45 +0000 (10:31 +0200)
The setup.pl script has been replaced with static BIND configurations,
and in the course of this change, the unused ns1 server was removed.
This enhancement has greatly improved the overall test's readability.

bin/tests/system/stress/clean.sh
bin/tests/system/stress/ns1/named.conf.in [deleted file]
bin/tests/system/stress/ns2/named.conf.in
bin/tests/system/stress/ns2/zone.template.db [new file with mode: 0644]
bin/tests/system/stress/ns3/named.conf.in
bin/tests/system/stress/ns4/named.conf.in
bin/tests/system/stress/setup.pl [deleted file]
bin/tests/system/stress/setup.sh

index 0396845cbd81170b8ca391bb31058b38bbc78e59..4833fa7df8e7c6ef620623deb2b6906852329224 100644 (file)
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-rm -f ns?/zones.conf
 rm -f ns?/zone*.bk
 
-rm -f ns1/delegations.db
-rm -f ns1/root.db
-
 rm -f ns2/zone0*.db
 rm -f ns2/zone0*.jnl
 rm -f */named.memstats
diff --git a/bin/tests/system/stress/ns1/named.conf.in b/bin/tests/system/stress/ns1/named.conf.in
deleted file mode 100644 (file)
index 74ad007..0000000
+++ /dev/null
@@ -1,32 +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.
- */
-
-controls { /* empty */ };
-
-options {
-       query-source address 10.53.0.1;
-       notify-source 10.53.0.1;
-       transfer-source 10.53.0.1;
-       port @PORT@;
-       pid-file "named.pid";
-       listen-on { 10.53.0.1; };
-       listen-on-v6 { none; };
-       recursion no;
-       dnssec-validation no;
-       notify yes;
-};
-
-zone "." {
-       type primary;
-       file "root.db";
-};
index 5bbea78acaca9bb08bff7f94e80242a5f9ad15b6..607e0b5341fec98cf756893ae968422d5b4dc38b 100644 (file)
@@ -26,9 +26,32 @@ options {
        notify yes;
 };
 
-zone "." {
-       type hint;
-       file "../../common/root.hint";
+zone "zone000000.example" {
+       type primary;
+       allow-update { any; };
+       file "zone000000.example.db";
 };
 
-include "zones.conf";
+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 (file)
index 0000000..7ca1cc3
--- /dev/null
@@ -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
index 036ffdbac2aa9ba829d245a49221f993b73fee91..13e54a54e46ff9d9bd504d93a5064ac7e4f7e907 100644 (file)
@@ -35,16 +35,40 @@ controls {
        inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
 };
 
-zone "." {
-       type hint;
-       file "../../common/root.hint";
-};
-
 server 10.53.0.4 {
        provide-ixfr no;
 };
+
 server 10.53.0.2 {
        request-ixfr no;
 };
 
-include "zones.conf";
+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; };
+};
index 57f7e40fddc6e587605bc8a7003d74b19e744bc0..26296f52bf0a558f42d612c22267a57bdb7aef27 100644 (file)
@@ -26,10 +26,32 @@ options {
        notify yes;
 };
 
-zone "." {
-       type hint;
-       file "../../common/root.hint";
+zone "zone000000.example" {
+       type secondary;
+       file "zone000000.example.bk";
+       primaries { 10.53.0.3; };
 };
 
-include "zones.conf";
+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.pl b/bin/tests/system/stress/setup.pl
deleted file mode 100644 (file)
index 18a4246..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/perl
-
-# 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 up test data for zone transfer quota tests.
-#
-use FileHandle;
-
-my $n_zones = 5;
-my $n_names = 1000;
-
-make_zones(2, undef);
-make_zones(3, "10.53.0.2");
-make_zones(4, "10.53.0.3");
-
-my $rootdelegations =
-    new FileHandle("ns1/root.db", "w") or die;
-
-print $rootdelegations <<END;
-\$TTL 300
-.                       IN SOA  gson.nominum.com. a.root.servers.nil. (
-                                              2000042100      ; serial
-                                              600             ; refresh
-                                              600             ; retry
-                                              1200            ; expire
-                                              600             ; minimum
-                                )
-.                       NS      a.root-servers.nil.
-a.root-servers.nil.     A       10.53.0.1
-END
-
-for ($z = 0; $z < $n_zones; $z++) {
-       my $zn = sprintf("zone%06d.example", $z);
-       foreach $ns (qw(2 3 4)) {
-               print $rootdelegations "$zn.            NS      ns$ns.$zn.\n";
-               print $rootdelegations "ns$ns.$zn.      A       10.53.0.$ns\n";
-       }
-}
-close $rootdelegations;
-
-sub make_zones {
-       my ($nsno, $secondaried_from) = @_;
-       my $namedconf = new FileHandle("ns$nsno/zones.conf", "w") or die;
-       for ($z = 0; $z < $n_zones; $z++) {
-               my $zn = sprintf("zone%06d.example", $z);
-               if (defined($secondaried_from)) {
-                       print $namedconf "zone \"$zn\" { type secondary; " .
-                           "file \"$zn.bk\"; primaries " .
-                           "{ $secondaried_from; }; };\n";
-               } else {
-                       print $namedconf "zone \"$zn\" { " .
-                           "type primary; " .
-                           "allow-update { any; }; " .
-                           "file \"$zn.db\"; };\n";
-
-                       my $fn = "ns$nsno/$zn.db";
-                       my $f = new FileHandle($fn, "w") or die "open: $fn: $!";
-                       print $f "\$TTL 300
-\@     IN SOA  ns2.$zn. hostmaster 1 300 120 3600 86400
-@      NS      ns2.$zn.
-ns2.$zn.       A       10.53.0.2
-@      NS      ns3.$zn.
-ns3.$zn.       A       10.53.0.3
-@      NS      ns4.$zn.
-ns4.$zn.       A       10.53.0.4
-       MX      10 mail1.isp.example.
-       MX      20 mail2.isp.example.
-";
-                       for ($i = 0; $i < $n_names; $i++) {
-                           print $f sprintf("name%06d", $i) .
-                               "       A       10.0.0.1\n";
-                   }
-                   $f->close;
-               }
-       }
-}
index cc751d3b7a09b0ba349be70afbd9a780cf78b555..aab7002904a51353cc2d676a4c0f4428af4fcf26 100644 (file)
 # shellcheck source=conf.sh
 . ../conf.sh
 
-#
-# Set up test data for zone transfer quota tests.
-#
-
-$PERL setup.pl
+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 ns1/named.conf.in ns1/named.conf
 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