Files
jcoffey-dev d85c6cf291
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 10m25s
Migrations: a live test against a server image
tests/resources/migrations/live-image-test.py IMAGE moves two accounts
from a Dovecot with the image's own inbuxa-migrate, and restarts the
server once the first is done. The run shows as interrupted, the secret
is gone with the restart, and the move carries on with it given again:
the first account "done earlier", the second to the end, every mailbox
whole and nothing twice. Then the passwords, a final pass that brings a
late message, and close. Docker and python3 only; it removes what it
starts.

seed.py takes --bulk N, a folder big enough for a run to be cut off.
2026-10-30 21:59:19 -07:00

33 lines
1.3 KiB
Python

# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: AGPL-3.0-only
#
# python3 seed.py PORT [--bulk N]: [email protected] gets three messages in
# INBOX, [email protected] one in INBOX and one in Projects. --bulk adds N more
# to b@'s Bulk folder, so a run over it lasts long enough to interrupt.
import imaplib, sys, time
port = int(sys.argv[1])
bulk = int(sys.argv[sys.argv.index("--bulk") + 1]) if "--bulk" in sys.argv else 0
def msg(n, subject):
return (f"From: [email protected]\r\nTo: [email protected]\r\nSubject: {subject}\r\n"
f"Message-ID: <e2e-{n}@example.net>\r\nDate: Mon, 4 Mar 2024 09:00:00 +0000\r\n\r\nHi {n}\r\n").encode()
for _ in range(50):
try:
imaplib.IMAP4("127.0.0.1", port).logout(); break
except OSError:
time.sleep(0.2)
a = imaplib.IMAP4("127.0.0.1", port); a.login("[email protected]", "pass-a")
for n in range(1, 4):
a.append("INBOX", r"(\Seen)" if n == 1 else None, None, msg(f"a{n}", f"A message {n}"))
a.logout()
b = imaplib.IMAP4("127.0.0.1", port); b.login("[email protected]", "pass-b")
b.create("Projects")
b.append("INBOX", None, None, msg("b1", "B inbox"))
b.append("Projects", r"(\Flagged)", None, msg("b2", "B project"))
if bulk:
b.create("Bulk")
for n in range(1, bulk + 1):
b.append("Bulk", None, None, msg(f"bulk{n}", f"Bulk {n}"))
b.logout()
print("seeded")