Commit 69e44c123d for bind

commit 69e44c123db0650e826c73273c8c1f38bfb607ee
Author: Matthijs Mekking <matthijs@isc.org>
Date:   Fri Nov 20 12:30:36 2026 +0100

    Update multisigner system test setup

    Instead of using shell scripts, use the pytest bootstrap method.

diff --git a/bin/tests/system/multisigner/ns5/model2.secondary.db.in b/bin/tests/system/multisigner/model2.db.j2.manual
similarity index 59%
rename from bin/tests/system/multisigner/ns5/model2.secondary.db.in
rename to bin/tests/system/multisigner/model2.db.j2.manual
index 69344dbcf8..aee243ced0 100644
--- a/bin/tests/system/multisigner/ns5/model2.secondary.db.in
+++ b/bin/tests/system/multisigner/model2.db.j2.manual
@@ -1,5 +1,6 @@
 $TTL 300
-@		IN	SOA  mname1. . (
+$ORIGIN @fqdn@
+@fqdn@		IN	SOA  mname1. . (
 			1       ; serial
 			20      ; refresh (20 seconds)
 			20      ; retry (20 seconds)
@@ -7,10 +8,10 @@ $TTL 300
 			3600    ; minimum (1 hour)
 			)

-			NS	ns3
-			NS	ns4
-ns3			A	10.53.0.3
-ns4			A	10.53.0.4
+{% for server in nameservers %}
+@fqdn@			NS	@server.name@
+@server.name@		A	@server.ip@
+{% endfor %}

 a			A	10.0.0.1
 b			A	10.0.0.2
diff --git a/bin/tests/system/multisigner/ns1/named.conf.j2 b/bin/tests/system/multisigner/ns1/named.conf.j2
index e896318ee4..f69b21b7b2 100644
--- a/bin/tests/system/multisigner/ns1/named.conf.j2
+++ b/bin/tests/system/multisigner/ns1/named.conf.j2
@@ -7,9 +7,4 @@ options {

 {% include "_common/controls.conf.j2" %}

-zone "." {
-	type primary;
-	file "root.db.signed";
-};
-
-include "trusted.conf";
+{% include "_common/zones.conf.j2" %}
diff --git a/bin/tests/system/multisigner/ns1/root.db.in b/bin/tests/system/multisigner/ns1/root.db.in
deleted file mode 100644
index 57213b66c4..0000000000
--- a/bin/tests/system/multisigner/ns1/root.db.in
+++ /dev/null
@@ -1,22 +0,0 @@
-$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
-
-multisigner.		NS	ns2.multisigner.
-ns2.multisigner.	A	10.53.0.2
-
-update-any.		NS	ns2.update-any.
-ns2.update-any.		A	10.53.0.2
-
-bad-dsync.		NS	ns2.bad-dsync.
-ns2.bad-dsync.		A	10.53.0.2
-
-secondary.		NS	ns2.secondary.
-ns2.secondary.		A	10.53.0.2
diff --git a/bin/tests/system/multisigner/ns1/setup.sh b/bin/tests/system/multisigner/ns1/setup.sh
deleted file mode 100644
index da2383d8b8..0000000000
--- a/bin/tests/system/multisigner/ns1/setup.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-set -e
-
-zone=.
-infile=root.db.in
-zonefile=root.db
-
-echo_i "ns1/setup.sh"
-
-for tld in multisigner update-any bad-dsync secondary; do
-  cp "../ns2/dsset-${tld}." .
-done
-
-KSK=$($KEYGEN -q -fk -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -b $DEFAULT_BITS $zone)
-
-cat $infile $KSK.key $ZSK.key >$zonefile
-
-$SIGNER -g -o $zone $zonefile >/dev/null 2>&1
-
-# Configure the resolving server with a static key.
-keyfile_to_static_ds "$KSK" >trusted.conf
-cp trusted.conf ../ns2/trusted.conf
-cp trusted.conf ../ns3/trusted.conf
-cp trusted.conf ../ns4/trusted.conf
-cp trusted.conf ../ns5/trusted.conf
diff --git a/bin/tests/system/multisigner/ns2/named.conf.j2 b/bin/tests/system/multisigner/ns2/named.conf.j2
index edbfe0c19c..9e32356675 100644
--- a/bin/tests/system/multisigner/ns2/named.conf.j2
+++ b/bin/tests/system/multisigner/ns2/named.conf.j2
@@ -9,26 +9,6 @@ options {

 {% include "_common/controls.conf.j2" %}

-zone "multisigner" {
-	type primary;
-	file "multisigner.db.signed";
-};
-
-zone "update-any" {
-	type primary;
-	file "update-any.db.signed";
-};
-
-zone "bad-dsync" {
-	type primary;
-	file "bad-dsync.db.signed";
-};
-
-zone "secondary" {
-	type primary;
-	file "secondary.db.signed";
-};
+{% include "_common/zones.conf.j2" %}

 {% include "_common/root.hint.conf" %}
-
-include "trusted.conf";
diff --git a/bin/tests/system/multisigner/ns2/setup.sh b/bin/tests/system/multisigner/ns2/setup.sh
deleted file mode 100644
index 786cfa4787..0000000000
--- a/bin/tests/system/multisigner/ns2/setup.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-echo_i "ns2/setup.sh"
-
-setup() {
-  zone="$1"
-  echo_i "setting up zone: $zone"
-  infile="${zone}.db.in"
-  zonefile="${zone}.db"
-
-  cp ../ns3/dsset-ns3-model2.$zone. .
-  cp ../ns4/dsset-ns4-model2.$zone. .
-
-  KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 -f KSK $zone)
-  ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zone)
-  $DSFROMKEY $KSK.key >dsset-ns2-${zone}.
-
-  cat $infile $KSK.key $ZSK.key >$zonefile
-  $SIGNER -g -o $zone $zonefile >/dev/null 2>&1
-}
-
-setup "multisigner"
-setup "update-any"
-setup "bad-dsync"
-setup "secondary"
diff --git a/bin/tests/system/multisigner/ns2/bad-dsync.db.in.j2 b/bin/tests/system/multisigner/ns2/zones/bad-dsync.db.j2.manual
similarity index 82%
rename from bin/tests/system/multisigner/ns2/bad-dsync.db.in.j2
rename to bin/tests/system/multisigner/ns2/zones/bad-dsync.db.j2.manual
index dd462626ab..f6dc3577ab 100644
--- a/bin/tests/system/multisigner/ns2/bad-dsync.db.in.j2
+++ b/bin/tests/system/multisigner/ns2/zones/bad-dsync.db.j2.manual
@@ -14,11 +14,7 @@ ns2			A	10.53.0.2

 scanner			A	10.53.0.2

-model2			NS	ns3
-			NS	ns4
-
-ns3.model2		A	10.53.0.3
-ns4.model2		A	10.53.0.4
-
 *._dsync		DSYNC	CDS NOTIFY @PORT@ scanner1
 *._dsync		DSYNC	CDS NOTIFY @PORT@ scanner2
+
+{% include '_common/zones/delegations.partial.db.j2' %}
diff --git a/bin/tests/system/multisigner/ns2/multisigner.db.in.j2 b/bin/tests/system/multisigner/ns2/zones/multisigner.db.j2.manual
similarity index 80%
rename from bin/tests/system/multisigner/ns2/multisigner.db.in.j2
rename to bin/tests/system/multisigner/ns2/zones/multisigner.db.j2.manual
index cec1e2bf77..e4cb0b0d75 100644
--- a/bin/tests/system/multisigner/ns2/multisigner.db.in.j2
+++ b/bin/tests/system/multisigner/ns2/zones/multisigner.db.j2.manual
@@ -14,10 +14,6 @@ ns2			A	10.53.0.2

 scanner			A	10.53.0.2

-model2			NS	ns3
-			NS	ns4
-
-ns3.model2		A	10.53.0.3
-ns4.model2		A	10.53.0.4
-
 *._dsync		DSYNC	CDS NOTIFY @PORT@ scanner
+
+{% include '_common/zones/delegations.partial.db.j2' %}
diff --git a/bin/tests/system/multisigner/ns2/secondary.db.in.j2 b/bin/tests/system/multisigner/ns2/zones/secondary.db.j2.manual
similarity index 87%
rename from bin/tests/system/multisigner/ns2/secondary.db.in.j2
rename to bin/tests/system/multisigner/ns2/zones/secondary.db.j2.manual
index 3f0175b584..177fe0cec9 100644
--- a/bin/tests/system/multisigner/ns2/secondary.db.in.j2
+++ b/bin/tests/system/multisigner/ns2/zones/secondary.db.j2.manual
@@ -15,12 +15,8 @@ ns2			A	10.53.0.2
 scanner			A	10.53.0.2
 bad-scanner		A	6.6.6.6

-model2			NS	ns3
-			NS	ns4
-
-ns3.model2		A	10.53.0.3
-ns4.model2		A	10.53.0.4
-
 model2._dsync		DSYNC	CDS NOTIFY @PORT@ scanner
 model2._dsync		DSYNC	CSYNC NOTIFY @CONTROLPORT@ bad-scanner ; ignored, unknown rrtype
 model2._dsync		DSYNC	DSYNC NOTIFY @CONTROLPORT@ bad-scanner ; ignored, bad rrtype
+
+{% include '_common/zones/delegations.partial.db.j2' %}
diff --git a/bin/tests/system/multisigner/ns2/update-any.db.in.j2 b/bin/tests/system/multisigner/ns2/zones/update-any.db.j2.manual
similarity index 80%
rename from bin/tests/system/multisigner/ns2/update-any.db.in.j2
rename to bin/tests/system/multisigner/ns2/zones/update-any.db.j2.manual
index e2cd55932e..bfdbd7e0cd 100644
--- a/bin/tests/system/multisigner/ns2/update-any.db.in.j2
+++ b/bin/tests/system/multisigner/ns2/zones/update-any.db.j2.manual
@@ -14,10 +14,6 @@ ns2			A	10.53.0.2

 scanner			A	10.53.0.2

-model2			NS	ns3
-			NS	ns4
-
-ns3.model2		A	10.53.0.3
-ns4.model2		A	10.53.0.4
-
 *._dsync		DSYNC	CDS NOTIFY @PORT@ scanner
+
+{% include '_common/zones/delegations.partial.db.j2' %}
diff --git a/bin/tests/system/multisigner/ns3/model2.bad-dsync.db b/bin/tests/system/multisigner/ns3/model2.bad-dsync.db
deleted file mode 100644
index 20e01d8926..0000000000
--- a/bin/tests/system/multisigner/ns3/model2.bad-dsync.db
+++ /dev/null
@@ -1,15 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns3
-ns3			A	10.53.0.3
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
diff --git a/bin/tests/system/multisigner/ns3/model2.multisigner.db b/bin/tests/system/multisigner/ns3/model2.multisigner.db
deleted file mode 100644
index 74fa7faa1a..0000000000
--- a/bin/tests/system/multisigner/ns3/model2.multisigner.db
+++ /dev/null
@@ -1,16 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns3
-ns3			A	10.53.0.3
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
-
diff --git a/bin/tests/system/multisigner/ns3/model2.update-any.db b/bin/tests/system/multisigner/ns3/model2.update-any.db
deleted file mode 100644
index 74fa7faa1a..0000000000
--- a/bin/tests/system/multisigner/ns3/model2.update-any.db
+++ /dev/null
@@ -1,16 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns3
-ns3			A	10.53.0.3
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
-
diff --git a/bin/tests/system/multisigner/ns3/named.conf.j2 b/bin/tests/system/multisigner/ns3/named.conf.j2
index 0007f12d3a..7492eccb29 100644
--- a/bin/tests/system/multisigner/ns3/named.conf.j2
+++ b/bin/tests/system/multisigner/ns3/named.conf.j2
@@ -2,6 +2,8 @@

 include "../kasp.conf";

+{% include "_common/trusted.conf.j2" %}
+
 options {
 	{% include_indented "_common/options.conf.j2" %}
 	allow-transfer { any; };
@@ -46,5 +48,3 @@ zone "model2.secondary." {
 };

 {% include "_common/root.hint.conf" %}
-
-include "trusted.conf";
diff --git a/bin/tests/system/multisigner/ns3/setup.sh b/bin/tests/system/multisigner/ns3/setup.sh
deleted file mode 100644
index 2aa711c856..0000000000
--- a/bin/tests/system/multisigner/ns3/setup.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-echo_i "ns3/setup.sh"
-
-O="OMNIPRESENT"
-ksktimes="-P now -A now -P sync now"
-zsktimes="-P now -A now"
-
-zone="model2.multisigner"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns3-${zone}.
-
-zone="model2.update-any"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns3-${zone}.
-
-zone="model2.bad-dsync"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns3-${zone}.
-
-zone="model2.secondary"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-cp "../ns5/${zonefile}.in" "$zonefile"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns3-${zone}.
-# ZSK will be added to the other provider with nsupdate.
-cat "${ZSK}.key" | grep -v ";.*" >"${zone}.zsk"
diff --git a/bin/tests/system/multisigner/ns4/model2.bad-dsync.db b/bin/tests/system/multisigner/ns4/model2.bad-dsync.db
deleted file mode 100644
index 8a84c8b72e..0000000000
--- a/bin/tests/system/multisigner/ns4/model2.bad-dsync.db
+++ /dev/null
@@ -1,15 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns4
-ns4			A	10.53.0.4
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
diff --git a/bin/tests/system/multisigner/ns4/model2.multisigner.db b/bin/tests/system/multisigner/ns4/model2.multisigner.db
deleted file mode 100644
index 8a84c8b72e..0000000000
--- a/bin/tests/system/multisigner/ns4/model2.multisigner.db
+++ /dev/null
@@ -1,15 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns4
-ns4			A	10.53.0.4
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
diff --git a/bin/tests/system/multisigner/ns4/model2.update-any.db b/bin/tests/system/multisigner/ns4/model2.update-any.db
deleted file mode 100644
index 8a84c8b72e..0000000000
--- a/bin/tests/system/multisigner/ns4/model2.update-any.db
+++ /dev/null
@@ -1,15 +0,0 @@
-$TTL 300
-@		IN	SOA  mname1. . (
-			1       ; serial
-			20      ; refresh (20 seconds)
-			20      ; retry (20 seconds)
-			1814400 ; expire (3 weeks)
-			3600    ; minimum (1 hour)
-			)
-
-			NS	ns4
-ns4			A	10.53.0.4
-
-a			A	10.0.0.1
-b			A	10.0.0.2
-c			A	10.0.0.3
diff --git a/bin/tests/system/multisigner/ns4/named.conf.j2 b/bin/tests/system/multisigner/ns4/named.conf.j2
index 9a37802af6..aa1f808156 100644
--- a/bin/tests/system/multisigner/ns4/named.conf.j2
+++ b/bin/tests/system/multisigner/ns4/named.conf.j2
@@ -2,6 +2,8 @@

 include "../kasp.conf";

+{% include "_common/trusted.conf.j2" %}
+
 options {
 	{% include_indented "_common/options.conf.j2" %}
 	allow-transfer { any; };
@@ -46,5 +48,3 @@ zone "model2.secondary." {
 };

 {% include "_common/root.hint.conf" %}
-
-include "trusted.conf";
diff --git a/bin/tests/system/multisigner/ns4/setup.sh b/bin/tests/system/multisigner/ns4/setup.sh
deleted file mode 100644
index 6d4509872e..0000000000
--- a/bin/tests/system/multisigner/ns4/setup.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-echo_i "ns4/setup.sh"
-
-O="OMNIPRESENT"
-ksktimes="-P now -A now -P sync now"
-zsktimes="-P now -A now"
-
-zone="model2.multisigner"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns4-${zone}.
-
-zone="model2.update-any"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns4-${zone}.
-
-zone="model2.bad-dsync"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns4-${zone}.
-
-zone="model2.secondary"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-cp "../ns5/${zonefile}.in" "$zonefile"
-KSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -f KSK -L 3600 $ksktimes $zone)
-ZSK=$($KEYGEN -q -a $DEFAULT_ALGORITHM -L 3600 $zsktimes $zone)
-$SETTIME -s -g $O -k $O now -r $O now -d $O now "$KSK" >settime.out.$zone.1 2>&1
-$SETTIME -s -g $O -k $O now -z $O now "$ZSK" >settime.out.$zone.2 2>&1
-$DSFROMKEY $KSK.key >dsset-ns4-${zone}.
-# ZSK will be added to the other provider with nsupdate.
-cat "${ZSK}.key" | grep -v ";.*" >"${zone}.zsk"
diff --git a/bin/tests/system/multisigner/ns5/named.conf.j2 b/bin/tests/system/multisigner/ns5/named.conf.j2
index 565d5f0f0d..7d39bc2c74 100644
--- a/bin/tests/system/multisigner/ns5/named.conf.j2
+++ b/bin/tests/system/multisigner/ns5/named.conf.j2
@@ -19,5 +19,3 @@ zone "model2.secondary." {
 };

 {% include "_common/root.hint.conf" %}
-
-include "trusted.conf";
diff --git a/bin/tests/system/multisigner/ns5/setup.sh b/bin/tests/system/multisigner/ns5/setup.sh
deleted file mode 100644
index 6bf3e6ffbc..0000000000
--- a/bin/tests/system/multisigner/ns5/setup.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-echo_i "ns5/setup.sh"
-
-zone="model2.secondary"
-echo_i "setting up zone: $zone"
-zonefile="${zone}.db"
-cp "${zonefile}.in" "$zonefile"
diff --git a/bin/tests/system/multisigner/setup.sh b/bin/tests/system/multisigner/setup.sh
deleted file mode 100644
index 12d7073d26..0000000000
--- a/bin/tests/system/multisigner/setup.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-set -e
-
-# multi-signers
-(
-  cd ns3
-  $SHELL setup.sh
-)
-(
-  cd ns4
-  $SHELL setup.sh
-)
-(
-  cd ns5
-  $SHELL setup.sh
-)
-# tld
-(
-  cd ns2
-  $SHELL setup.sh
-)
-# root
-(
-  cd ns1
-  $SHELL setup.sh
-)
diff --git a/bin/tests/system/multisigner/tests_multisigner.py b/bin/tests/system/multisigner/tests_multisigner.py
index 21674f1745..08610b6aaf 100644
--- a/bin/tests/system/multisigner/tests_multisigner.py
+++ b/bin/tests/system/multisigner/tests_multisigner.py
@@ -10,6 +10,7 @@
 # information regarding copyright ownership.

 from datetime import timedelta
+from pathlib import Path
 from re import compile as Re

 import os
@@ -17,6 +18,12 @@ import os
 import dns.update
 import pytest

+from isctest.algorithms import Algorithm
+from isctest.kasp import SettimeOptions
+from isctest.run import EnvCmd
+from isctest.template import NS2, Nameserver
+from isctest.zone import Zone, configure_root
+
 import isctest

 pytestmark = pytest.mark.extra_artifacts(
@@ -37,14 +44,14 @@ pytestmark = pytest.mark.extra_artifacts(
         "ns*/*.jnl",
         "ns*/*.journal.out.*",
         "ns*/*.signed",
-        "ns*/*.zsk",
         "ns*/db-*",
         "ns*/dsset-*",
         "ns*/K*",
         "ns*/keygen.out.*",
         "ns*/managed-keys.bind*",
-        "ns*/settime.out.*",
         "ns*/trusted.conf",
+        "ns*/zones/*.db",
+        "ns*/zones/*.db.signed",
     ]
 )

@@ -62,19 +69,121 @@ CONFIG = {
 TTL = 3600


-def dsfromkey(key):
-    dsfromkey_command = [
-        os.environ.get("DSFROMKEY"),
-        "-T",
-        str(TTL),
-        "-a",
-        "SHA-256",
-        "-C",
-        "-w",
-        str(key.keyfile),
-    ]
-    cmd = isctest.run.cmd(dsfromkey_command)
-    return cmd.out.split()
+def configure_tld(zonename: str, delegations: list[Zone]) -> Zone:
+    for zone in delegations:
+        # Each provider has a DS of its own for the same zone.
+        ds = Path(f"{zone.ns.name}/dsset-{zone.name}.").read_text(encoding="utf-8")
+        with open(f"ns2/dsset-{zone.name}.", "a", encoding="utf-8") as dsset:
+            dsset.write(ds)
+
+    tld = Zone(zonename, NS2, signed=True)
+    tld.delegations = delegations
+    tld.configure()
+
+    return tld
+
+
+def dsfromkey(key, cds=True):
+    dsfromkey_command = EnvCmd("DSFROMKEY", f"-T {TTL} -a SHA-256 -w")
+
+    if cds:
+        cmd = dsfromkey_command(f"-C {key.keyfile}")
+    else:
+        cmd = dsfromkey_command(f"{key.keyfile}")
+
+    return cmd
+
+
+def cdsfromkey(key):
+    cmd = dsfromkey(key, cds=True)
+    return cmd.out.strip().split()
+
+
+def setup_keys(zonename, keydir) -> None:
+    default_algorithm = Algorithm.default()
+    keygen = EnvCmd(
+        "KEYGEN",
+        f"-q -a {default_algorithm.number} -b {default_algorithm.bits} -L 3600",
+    )
+
+    when = "now-7d"
+    ksk_timings = SettimeOptions(
+        g="OMNIPRESENT",
+        k=f"OMNIPRESENT {when}",
+        r=f"OMNIPRESENT {when}",
+        d=f"OMNIPRESENT {when}",
+    )
+    zsk_timings = SettimeOptions(
+        g="OMNIPRESENT",
+        k=f"OMNIPRESENT {when}",
+        z=f"OMNIPRESENT {when}",
+    )
+
+    # Key generation.
+    ksk_name = keygen(f"-f KSK -P {when} -A {when} {zonename}", cwd=keydir).out.strip()
+    zsk_name = keygen(f"-P {when} -A {when} {zonename}", cwd=keydir).out.strip()
+    # Key state timing metadata.
+    isctest.kasp.Key(ksk_name, keydir=keydir).settime(ksk_timings)
+    isctest.kasp.Key(zsk_name, keydir=keydir).settime(zsk_timings)
+    # DS from KSK.
+    ksk = isctest.kasp.Key(ksk_name, keydir=keydir)
+    ds = dsfromkey(ksk, cds=False).out.strip()
+    with open(f"{keydir}/dsset-{zonename}.", "w", encoding="utf-8") as f:
+        f.write(f"{ds}\n")
+
+
+def setup_zone(zonename, primary, servers) -> Zone:
+    templates = isctest.template.TemplateEngine(".")
+
+    # Configuration.
+    isctest.log.info(f"setup {zonename}")
+    template = "model2.db.j2.manual"
+    outfile = f"{zonename}.db"
+
+    ns = []
+    for server in servers:
+        ns.append(Nameserver(server))
+
+    tdata = {
+        "fqdn": f"{zonename}.",
+        "nameservers": ns,
+    }
+    templates.render(f"{primary}/{outfile}", tdata, template=template)
+
+    return Zone(zonename, Nameserver(primary))
+
+
+def bootstrap():
+    # Chain of trust.
+    tld_zones = []
+
+    tlds = ["multisigner", "update-any", "bad-dsync"]
+    for tld in tlds:
+        zones = []
+        zonename = f"model2.{tld}"
+        zones.append(setup_zone(zonename, "ns3", ["ns3"]))
+        zones.append(setup_zone(zonename, "ns4", ["ns4"]))
+        setup_keys(zonename, "ns3")
+        setup_keys(zonename, "ns4")
+
+        tld_zones.append(configure_tld(tld, zones))
+
+    tld = "secondary"
+    zones = []
+    zone = setup_zone(f"model2.{tld}", "ns5", ["ns3", "ns4"])
+    zones.append(Zone(zone.name, Nameserver("ns3")))
+    zones.append(Zone(zone.name, Nameserver("ns4")))
+    setup_keys(zone.name, "ns3")
+    setup_keys(zone.name, "ns4")
+
+    tld_zones.append(configure_tld(tld, zones))
+
+    root = configure_root(tld_zones)
+
+    return {
+        "trust_anchors": root.trust_anchors(),
+        "zones": isctest.template.zones([root, *tld_zones]),
+    }


 def check_dnssec(server, zone, keys, expected):
@@ -422,7 +531,7 @@ def check_add_cds(server, zone, keys, expected, extra_keys, extra, primary=None)
     # Update the server with the CDS record from the other providers.
     update_msg = dns.update.UpdateMessage(zone)
     for ksk in extra_keys:
-        ds = dsfromkey(ksk)
+        ds = cdsfromkey(ksk)
         rdata = " ".join(ds[4:])
         update_msg.add(f"{zone}.", TTL, "CDS", rdata)
     nsupdate_and_wait(primary, server, zone, update_msg)
@@ -454,7 +563,7 @@ def _check_remove_cds_fail(
     )

     ksks = [k for k in keys if not k.is_ksk()]
-    ds = dsfromkey(ksks[0])
+    ds = cdsfromkey(ksks[0])
     rdata = " ".join(ds[4:])
     update_msg = dns.update.UpdateMessage(zone)
     update_msg.delete(f"{zone}.", "CDS", rdata)
@@ -516,7 +625,7 @@ def check_remove_cds(

         update_msg = dns.update.UpdateMessage(zone)
         for ksk in extra_keys:
-            ds = dsfromkey(ksk)
+            ds = cdsfromkey(ksk)
             rdata = " ".join(ds[4:])
             update_msg.delete(f"{zone}.", "CDS", rdata)
     nsupdate_and_wait(primary, server, zone, update_msg)