Use recoverable target in STQ-04 fixture
Debian Trixie package bundle / packages (push) Successful in 21m34s

This commit is contained in:
Mario Fetka
2026-07-23 09:25:05 +02:00
parent 994dfe9c2e
commit ffd0e4d4f3
3 changed files with 20 additions and 9 deletions
@@ -28,10 +28,15 @@ queue_id=
tmpfs_mounted=0
spool_mounted=0
blocked_mounted=0
fill_open=0
restore()
{
status=$?
if [ "$fill_open" -eq 1 ]; then
exec 9>&-
fill_open=0
fi
$as_root /usr/bin/systemctl stop "$service" >/dev/null 2>&1 || true
if [ "$blocked_mounted" -eq 1 ]; then
$as_root /usr/bin/umount "$spool" >/dev/null 2>&1 || true
@@ -82,7 +87,7 @@ printf '%s\r\n' \
>"$work/message.eml"
chmod 0644 "$work/message.eml"
queue_id=$($as_bongo "$queue_tool" hold-local "$work/message.eml")
queue_id=$($as_bongo "$queue_tool" hold-local "$work/message.eml" 9)
$as_bongo "$queue_tool" message "$queue_id" >"$work/before.eml"
before_hash=$(sha256sum "$work/before.eml" | awk '{ print $1 }')
@@ -91,6 +96,7 @@ reported_before=$4
block=$5
fill_blocks=$((reported_before / block + 1))
exec 9>"$tmpfs/.stq04-fill"
fill_open=1
rm "$tmpfs/.stq04-fill"
/usr/bin/dd if=/dev/zero bs="$block" count="$fill_blocks" status=none >&9
$as_root /usr/bin/systemctl restart "$service"
@@ -113,6 +119,7 @@ if ! grep -F 'Free disk space too low' "$work/full.err" >/dev/null; then
fi
$as_bongo "$queue_tool" message "$queue_id" >"$work/after-full.eml"
exec 9>&-
fill_open=0
$as_root /usr/bin/systemctl stop "$service"
$as_root /usr/bin/mount --bind "$blocked" "$spool"
+5 -4
View File
@@ -46,10 +46,11 @@ Write the exact queued message bytes to standard output.
Permanently remove one queue entry and its message data.
.SH "QUEUE RECOVERY AND DIAGNOSTIC COMMANDS"
.TP
.BI "hold-local " MESSAGE-FILE
Create a queue entry in the isolated diagnostic target 999 and print its
queue ID. The message remains held until it is explicitly delivered or
deleted.
.BI "hold-local " MESSAGE-FILE " [" TARGET ]
Create a queue entry and print its queue ID. The default isolated diagnostic
target is 999. An explicit target is intended for bounded recovery tests which
must exercise a normal Queue class; it must be between 0 and 999. The message
remains held until it is explicitly delivered or deleted.
.TP
.BI "deliver-local " "QUEUE-ID SENDER RECIPIENT " [ MAILBOX ]
Copy an existing queued message directly to a local Store mailbox. The
+7 -4
View File
@@ -116,17 +116,20 @@ class HoldLocalCommand(Command):
Command.__init__(
self, "hold-local",
summary="Create an isolated local-delivery queue fixture",
usage="%prog %cmd <message-file>")
usage="%prog %cmd <message-file> [<target>]")
def Run(self, options, args):
if len(args) != 1:
self.error("exactly one message file is required")
if len(args) < 1 or len(args) > 2:
self.error("a message file and optional queue target are required")
target = int(args[1]) if len(args) == 2 else 999
if target < 0 or target > 999:
self.error("queue target must be between 0 and 999")
with open(args[0], "rb") as message_file:
message = message_file.read()
queue = QueueClient(host=options.host, port=options.port)
try:
queue.Create(999)
queue.Create(target)
queue.StoreMessage(message)
response = queue.Run()
print(response.message.split(" ", 1)[0])