feat: allow to run the test suite against underscore-domain relays

Such relays serve self-signed certificates, and are created e.g. by cmlxc deploys.
This commit is contained in:
holger krekel
2026-08-14 12:09:24 +02:00
parent feb777f704
commit 0f8c91570b
4 changed files with 40 additions and 9 deletions
@@ -11,6 +11,7 @@ import socket
import subprocess
import sys
import time
import urllib.parse
from typing import AsyncGenerator, Optional
import pytest
@@ -305,10 +306,16 @@ def alice_and_remote_bob(tmp_path, acfactory, get_core_python_env):
accounts_dir = str(tmp_path.joinpath("account1_venv1"))
channel = gw.remote_exec(remote_bob_loop)
cm = os.environ.get("CHATMAIL_DOMAIN")
# old cores need "ic=3" to accept
# the self-signed cert of an underscore domain
addr, password = acfactory.get_credentials()
dclogin_qr = f"dclogin://{urllib.parse.quote(addr, safe='@')}?p={urllib.parse.quote(password)}&v=1"
if os.environ["CHATMAIL_DOMAIN"].startswith("_"):
dclogin_qr += "&ic=3"
# trigger getting an online account on bob's side
channel.send((accounts_dir, str(rpc_server_path), cm))
channel.send((accounts_dir, str(rpc_server_path), dclogin_qr))
# meanwhile get a local alice account
alice = acfactory.get_online_account()
@@ -340,10 +347,8 @@ def remote_bob_loop(channel):
import os
from deltachat_rpc_client import DeltaChat, Rpc
from deltachat_rpc_client.pytestplugin import ACFactory
accounts_dir, rpc_server_path, chatmail_domain = channel.receive()
os.environ["CHATMAIL_DOMAIN"] = chatmail_domain
accounts_dir, rpc_server_path, dclogin_qr = channel.receive()
# older core versions don't support specifying rpc_server_path
# so we can't just pass `rpc_server_path` argument to Rpc constructor
@@ -354,8 +359,16 @@ def remote_bob_loop(channel):
with rpc:
dc = DeltaChat(rpc)
channel.send(dc.rpc.get_system_info()["deltachat_core_version"])
acfactory = ACFactory(dc)
bob = acfactory.get_online_account()
# ACFactory would configure from a "dcaccount" QR,
# which old cores cannot use on underscore domains
bob = dc.add_account()
bob.set_config_from_qr(dclogin_qr)
if not bob.is_configured():
# cores <=2.22 only store login values from a "dclogin" QR
bob.configure()
bob.bring_online()
alice_vcard = channel.receive()
[alice_contact] = bob.import_vcard(alice_vcard)
ns = {"bob": bob, "bob_contact_alice": alice_contact}