mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 21:08:03 +00:00
try fix CI
This commit is contained in:
@@ -18,6 +18,10 @@ FileEntry = namedtuple("FileEntry", ("relpath", "mtime", "size"))
|
|||||||
|
|
||||||
|
|
||||||
def iter_mailboxes(basedir, maxnum):
|
def iter_mailboxes(basedir, maxnum):
|
||||||
|
if not os.path.exists(basedir):
|
||||||
|
print_info(f"no mailboxes found at: {basedir}")
|
||||||
|
return
|
||||||
|
|
||||||
for name in os.listdir(basedir)[:maxnum]:
|
for name in os.listdir(basedir)[:maxnum]:
|
||||||
if "@" in name:
|
if "@" in name:
|
||||||
yield MailboxStat(basedir + "/" + name)
|
yield MailboxStat(basedir + "/" + name)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from chatmaild.expire import FileEntry, MailboxStat
|
from chatmaild.expire import FileEntry, MailboxStat, iter_mailboxes
|
||||||
from chatmaild.expire import main as expiry_main
|
from chatmaild.expire import main as expiry_main
|
||||||
from chatmaild.fsreport import main as report_main
|
from chatmaild.fsreport import main as report_main
|
||||||
|
|
||||||
@@ -51,6 +51,12 @@ def test_filentry_ordering(tmp_path):
|
|||||||
assert l == sorted
|
assert l == sorted
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_mailbxoes(tmp_path, capsys):
|
||||||
|
assert [] == list(iter_mailboxes(str(tmp_path.joinpath("notexists")), maxnum=10))
|
||||||
|
out, err = capsys.readouterr()
|
||||||
|
assert "no mailboxes" in err
|
||||||
|
|
||||||
|
|
||||||
def test_stats_mailbox(mbox1):
|
def test_stats_mailbox(mbox1):
|
||||||
password = Path(mbox1.basedir).joinpath("password")
|
password = Path(mbox1.basedir).joinpath("password")
|
||||||
assert mbox1.last_login == password.stat().st_mtime
|
assert mbox1.last_login == password.stat().st_mtime
|
||||||
|
|||||||
@@ -153,11 +153,16 @@ def _install_remote_venv_with_chatmaild(config) -> None:
|
|||||||
dest=f"/etc/systemd/system/{basename}",
|
dest=f"/etc/systemd/system/{basename}",
|
||||||
**root_owned,
|
**root_owned,
|
||||||
)
|
)
|
||||||
|
if fn == "chatmail-expire" or fn == "chatmail-fsreport":
|
||||||
|
# don't auto-start but let the corresponding timer trigger execution
|
||||||
|
enabled = False
|
||||||
|
else:
|
||||||
|
enabled = True
|
||||||
systemd.service(
|
systemd.service(
|
||||||
name=f"Setup {basename}",
|
name=f"Setup {basename}",
|
||||||
service=basename,
|
service=basename,
|
||||||
running=True,
|
running=True,
|
||||||
enabled=True,
|
enabled=enabled,
|
||||||
restarted=True,
|
restarted=True,
|
||||||
daemon_reload=True,
|
daemon_reload=True,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ Description=Run Daily chatmail-expire job
|
|||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* 00:02:00
|
OnCalendar=*-*-* 00:02:00
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
|
|||||||
Reference in New Issue
Block a user