mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
generalize remotelog to "remote" and offer remote.iter_output method
This commit is contained in:
@@ -182,15 +182,15 @@ def cmfactory(request, gencreds, tmpdir, data, maildomain):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def remotelog(sshdomain):
|
||||
return RemoteLog(sshdomain)
|
||||
def remote(sshdomain):
|
||||
return Remote(sshdomain)
|
||||
|
||||
|
||||
class RemoteLog:
|
||||
class Remote:
|
||||
def __init__(self, sshdomain):
|
||||
self.sshdomain = sshdomain
|
||||
|
||||
def iter(self, logcmd=""):
|
||||
def iter_output(self, logcmd=""):
|
||||
getjournal = f"journalctl -f" if not logcmd else logcmd
|
||||
self.popen = subprocess.Popen(
|
||||
["ssh", f"root@{self.sshdomain}", getjournal],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
def test_remotelog(remotelog, imap_or_smtp):
|
||||
lineproducer = remotelog.iter(imap_or_smtp.logcmd)
|
||||
def test_remote(remote, imap_or_smtp):
|
||||
lineproducer = remote.iter_output(imap_or_smtp.logcmd)
|
||||
imap_or_smtp.connect()
|
||||
assert imap_or_smtp.name in next(lineproducer)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class TestEndToEndDeltaChat:
|
||||
assert msg2.text == "message0"
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_exceed_quota(self, cmfactory, lp, tmpdir, remotelog):
|
||||
def test_exceed_quota(self, cmfactory, lp, tmpdir, remote):
|
||||
"""This is a very slow test as it needs to upload >100MB of mail data
|
||||
before quota is exceeded, and thus depends on the speed of the upload.
|
||||
"""
|
||||
@@ -48,7 +48,7 @@ class TestEndToEndDeltaChat:
|
||||
|
||||
addr = ac2.get_config("addr").lower()
|
||||
saved_ok = 0
|
||||
for line in remotelog.iter("journalctl -f -u dovecot"):
|
||||
for line in remote.iter_output("journalctl -f -u dovecot"):
|
||||
if addr not in line:
|
||||
# print(line)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user