Skip to content

fix(cmdeploy): make tests work with --ssh-host localhost#856

Merged
missytake merged 9 commits intomainfrom
tests-localhost
Feb 19, 2026
Merged

fix(cmdeploy): make tests work with --ssh-host localhost#856
missytake merged 9 commits intomainfrom
tests-localhost

Conversation

@missytake
Copy link
Contributor

@missytake missytake commented Feb 18, 2026

Taken out of #852, in any case also useful for docker, and anyone who uses ssh-host localhost today.

(let's squash them on merging)

@missytake
Copy link
Contributor Author

Hm, cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py::TestMetadataTokens::test_set_get_metadata seems to be a bit flaky.

@missytake
Copy link
Contributor Author

Hm, cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py::TestMetadataTokens::test_set_get_metadata seems to be a bit flaky.

The journald of chatmaild-metadata claims:

Feb 18 08:56:22 staging-ipv4 systemd[1]: chatmail-metadata.service: Scheduled restart job, restart counter is at 1.
Feb 18 08:56:22 staging-ipv4 systemd[1]: Stopped chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.
Feb 18 08:56:22 staging-ipv4 systemd[1]: Started chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.
Feb 18 08:56:22 staging-ipv4 chatmail-metadata[33037]: ERROR:root:vmail dir does not exist: PosixPath('/home/vmail/mail/staging-ipv4.testrun.org')

running it later suddenly succeeds. It should be run after the tests which create addresses.

@missytake missytake temporarily deployed to staging-ipv4.testrun.org February 18, 2026 09:01 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging2.testrun.org February 18, 2026 09:01 — with GitHub Actions Inactive
@missytake
Copy link
Contributor Author

running it later suddenly succeeds. It should be run after the tests which create addresses.

In https://github.com/chatmail/relay/actions/runs/22133199294/job/63978158827?pr=852 it failed again - the logs say, that the chatmail-metadata.service simply wasn't running at the time:

___________________ TestMetadataTokens.test_set_get_metadata ___________________
[gw2] linux -- Python 3.11.2 /root/relay/venv/bin/python3

self = <tests.online.test_2_deltachat.TestMetadataTokens object at 0x7f2ecc6772d0>
imap_mailbox = <imap_tools.mailbox.MailBox object at 0x7f2ebfba9e90>

    def test_set_get_metadata(self, imap_mailbox):
        "set and get metadata token for an account"
        client = imap_mailbox.client
        client.send(b'a01 SETMETADATA INBOX (/private/devicetoken "1111" )\n')
        res = client.readline()
>       assert b"OK Setmetadata completed" in res
E       AssertionError: assert b'OK Setmetadata completed' in b'a01 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2026-02-18 09:16:32] (0.001 + 0.000 secs).\r\n'

cmdeploy/src/cmdeploy/tests/online/test_2_deltachat.py:167: AssertionError
---------------------------- Captured stdout setup -----------------------------
WARN: could not use preconfigured keys
[acsetup] 0.130 started configure on <Account path=/tmp/pytest-of-root/pytest-0/popen-gw2/test_set_get_metadata0/ac1/dc.db>
bringing accounts online
wait_all_configured finds accounts= {<Account path=/tmp/pytest-of-root/pytest-0/popen-gw2/test_set_get_metadata0/ac1/dc.db>: 'CONFIGURING'}
ac1 waiting for inbox IDLE to become ready
finished, account2state {<Account path=/tmp/pytest-of-root/pytest-0/popen-gw2/test_set_get_metadata0/ac1/dc.db>: 'IDLEREADY'}
all accounts online
Feb 18 09:16:19 staging-ipv4 systemd[1]: chatmail-metadata.service: Scheduled restart job, restart counter is at 1.
Feb 18 09:16:19 staging-ipv4 systemd[1]: Stopped chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.
Feb 18 09:16:19 staging-ipv4 systemd[1]: Started chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.
Feb 18 09:16:19 staging-ipv4 chatmail-metadata[33032]: ERROR:root:vmail dir does not exist: PosixPath('/home/vmail/mail/staging-ipv4.testrun.org')
Feb 18 09:16:19 staging-ipv4 systemd[1]: chatmail-metadata.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 09:16:19 staging-ipv4 systemd[1]: chatmail-metadata.service: Failed with result 'exit-code'.
Feb 18 09:16:49 staging-ipv4 systemd[1]: chatmail-metadata.service: Scheduled restart job, restart counter is at 2.
Feb 18 09:16:49 staging-ipv4 systemd[1]: Stopped chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.
Feb 18 09:16:49 staging-ipv4 systemd[1]: Started chatmail-metadata.service - Chatmail dict proxy for IMAP METADATA.

So it's a question of service startup time. We should throw in a systemctl restart after activating dovecot, for good measure.

@missytake missytake temporarily deployed to staging-ipv4.testrun.org February 18, 2026 09:29 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging2.testrun.org February 18, 2026 09:29 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging2.testrun.org February 18, 2026 09:29 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging-ipv4.testrun.org February 18, 2026 09:29 — with GitHub Actions Inactive
@missytake
Copy link
Contributor Author

Hm, seems like directly after activating dovecot, /home/vmail/mail still doesn't exist, chatmail-metadata failed again.

@missytake
Copy link
Contributor Author

Hm, seems like directly after activating dovecot, /home/vmail/mail still doesn't exist, chatmail-metadata failed again.

I simply lowered RestartSec for chatmail-metadata - 10 was still a close call until the tests ran, 5 should be a bit safer.

So this should be fixed now, ready for review :)

@missytake missytake temporarily deployed to staging2.testrun.org February 18, 2026 13:00 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging-ipv4.testrun.org February 18, 2026 13:00 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging-ipv4.testrun.org February 19, 2026 09:36 — with GitHub Actions Inactive
@missytake missytake temporarily deployed to staging2.testrun.org February 19, 2026 09:36 — with GitHub Actions Inactive
Copy link
Contributor

@j4n j4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Test deployed as docker image, where @local made the tests work :)

@missytake missytake merged commit 38cc1c7 into main Feb 19, 2026
6 checks passed
@missytake missytake deleted the tests-localhost branch February 19, 2026 20:34
j4n pushed a commit that referenced this pull request Feb 23, 2026
* tests: fix test_remote[imap]
* cmdeploy: call LocalExec directly, not .logged()
* tests: fix TestSSHExecutor.test_logged
* tests: fix test_status_cmd with --ssh-host @Local
* tests: fix test_logged with --ssh-host localhost
* tests: fix TestSSHExecutor::test_exception with --ssh-host localhost
* ci: deploy with --ssh-host localhost on staging-ipv4
* metadata: lower RestartSec
missytake added a commit that referenced this pull request Mar 4, 2026
fix a flaky test: #856 (comment)
since #856 chatmail-metadata is restarted every 5 second, if it didn't come up after that, the failure likely sits deeper.
j4n pushed a commit that referenced this pull request Mar 4, 2026
fix a flaky test: #856 (comment)
since #856 chatmail-metadata is restarted every 5 second, if it didn't come up after that, the failure likely sits deeper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants