exercise named-makejournal with multiple transactions

the journal system test now checks that named-makejournal is
able to create journal files with multiple transactions.
This commit is contained in:
Evan Hunt 2025-02-14 18:12:09 -08:00
parent 365e4de077
commit 27a34fdac1
6 changed files with 135 additions and 0 deletions

View file

@ -250,6 +250,46 @@ echo_i "check that journal is applied to zone with keydata placeholder record"
ret=0
grep 'managed-keys-zone: journal rollforward completed successfully: up to date' ns2/named.run >/dev/null 2>&1 || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=$((status + ret))
n=$((n + 1))
echo_i "check named-makejournal with multiple transactions ($n)"
ret=0
# fail if there's no delta to journal
$MAKEJOURNAL example zones/example.db zones/example.db >makejournal.out.test$n 2>&1 && ret=1
grep -q "Error: SOA serial (1) unchanged between files" makejournal.out.test$n || ret=1
# add first delta to journal
$MAKEJOURNAL example zones/example.db zones/example2.db >/dev/null 2>&1 || ret=1
# warn if the new transaction doesn't update the serial
$MAKEJOURNAL example zones/example.db zones/example2.db >makejournal.out.test$n 2>&1 || ret=1
grep -q "Journal zones/example.db.jnl already has serial 2" makejournal.out.test$n || ret=1
# now add a second delta and count the transactions
$MAKEJOURNAL example zones/example.db zones/example3.db >/dev/null 2>&1 || ret=1
$JOURNALPRINT zones/example.db.jnl >journalprint.out.test$n
soas=$(awk '$5 == "SOA" {print}' journalprint.out.test$n | wc -l)
[ "$soas" -eq 4 ] || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=$((status + ret))
n=$((n + 1))
echo_i "check named-makejournal with bad serial numbers ($n)"
ret=0
# fail if the serial number goes backwards
rm -f zones/example.db.jnl zones/example3.db.jnl
$MAKEJOURNAL example zones/example3.db zones/example.db >makejournal.out.test$n 2>&1 && ret=1
grep -q "malformed transaction: serial number did not increase" makejournal.out.test$n || ret=1
# fail if the old serial number is missing from the journal
$MAKEJOURNAL example zones/example.db zones/example3.db >makejournal.out.test$n 2>&1 || ret=1
# rename the 1->3 journal so it will be used for 2->3.
mv zones/example.db.jnl zones/example2.db.jnl
$MAKEJOURNAL example zones/example2.db zones/example3.db >makejournal.out.test$n 2>&1 && ret=1
grep -q "journal zones/example2.db.jnl out of sync with zone" makejournal.out.test$n || ret=1
# increase serial number by exactly 0x80000000
rm -f zones/example3.db.jnl
$MAKEJOURNAL example zones/example3.db zones/example-hi.db >makejournal.out.test$n 2>&1 && ret=1
grep -q "malformed transaction: serial number did not increase" makejournal.out.test$n || ret=1
[ $ret -eq 0 ] || echo_i "failed"
status=$((status + ret))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1

View file

@ -15,11 +15,13 @@ pytestmark = pytest.mark.extra_artifacts(
[
"dig.out.*",
"journalprint.out.*",
"makejournal.out.*",
"tmp.jnl",
"ns*/*.db",
"ns*/*.jnl",
"ns1/managed-keys.bind",
"ns2/managed-keys.bind",
"zones/*.jnl",
]
)

View file

@ -0,0 +1,23 @@
; 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.
$ORIGIN example.
$TTL 300 ; 5 minutes
@ IN SOA ns1.example. hostmaster.example. (
2147483651 ; serial
2000 ; refresh (33 minutes 20 seconds)
2000 ; retry (33 minutes 20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns1.example.
ns1 A 10.53.0.1
b A 192.0.1.2
c A 192.0.1.3

View file

@ -0,0 +1,23 @@
; 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.
$ORIGIN example.
$TTL 300 ; 5 minutes
@ IN SOA ns1.example. hostmaster.example. (
1 ; serial
2000 ; refresh (33 minutes 20 seconds)
2000 ; retry (33 minutes 20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns1.example.
ns1 A 10.53.0.1
a A 192.0.1.1
b A 192.0.1.2

View file

@ -0,0 +1,24 @@
; 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.
$ORIGIN example.
$TTL 300 ; 5 minutes
@ IN SOA ns1.example. hostmaster.example. (
2 ; serial
2000 ; refresh (33 minutes 20 seconds)
2000 ; retry (33 minutes 20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns1.example.
ns1 A 10.53.0.1
a A 192.0.1.1
b A 192.0.1.2
c A 192.0.1.3

View file

@ -0,0 +1,23 @@
; 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.
$ORIGIN example.
$TTL 300 ; 5 minutes
@ IN SOA ns1.example. hostmaster.example. (
3 ; serial
2000 ; refresh (33 minutes 20 seconds)
2000 ; retry (33 minutes 20 seconds)
1814400 ; expire (3 weeks)
3600 ; minimum (1 hour)
)
NS ns1.example.
ns1 A 10.53.0.1
b A 192.0.1.2
c A 192.0.1.3