Skip to content

tests: test more reliably if port 25 is reachable #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chatmaild/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ lint.select = [
"PLE", # Pylint Error
"PLW", # Pylint Warning
]
lint.ignore = [
"PLC0415" # import-outside-top-level
]

[tool.tox]
legacy_tox_ini = """
Expand Down
3 changes: 3 additions & 0 deletions cmdeploy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ lint.select = [
"PLE", # Pylint Error
"PLW", # Pylint Warning
]
lint.ignore = [
"PLC0415" # import-outside-top-level
]
6 changes: 1 addition & 5 deletions cmdeploy/src/cmdeploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,7 @@ def check_config(config):

def deploy_mtail(config):
# Uninstall mtail package, we are going to install a static binary.
apt.packages(
name="Uninstall mtail",
packages=["mtail"],
present=False
)
apt.packages(name="Uninstall mtail", packages=["mtail"], present=False)

(url, sha256sum) = {
"x86_64": (
Expand Down
14 changes: 10 additions & 4 deletions cmdeploy/src/cmdeploy/tests/online/test_1_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import smtplib
import socket
import subprocess

import pytest
Expand Down Expand Up @@ -118,14 +119,19 @@ def test_authenticated_from(cmsetup, maildata):

@pytest.mark.parametrize("from_addr", ["[email protected]", "[email protected]"])
def test_reject_missing_dkim(cmsetup, maildata, from_addr):
domain = cmsetup.maildomain
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(10)
try:
sock.connect((domain, 25))
except socket.timeout:
pytest.skip(f"port 25 not reachable for {domain}")

recipient = cmsetup.gen_users(1)[0]
msg = maildata(
"encrypted.eml", from_addr=from_addr, to_addr=recipient.addr
).as_string()
try:
conn = smtplib.SMTP(cmsetup.maildomain, 25, timeout=10)
except TimeoutError:
pytest.skip(f"port 25 not reachable for {cmsetup.maildomain}")
conn = smtplib.SMTP(cmsetup.maildomain, 25, timeout=10)

with conn as s:
with pytest.raises(smtplib.SMTPDataError, match="No valid DKIM signature"):
Expand Down