Skip to content

refactor: smtpd->aiosmtpd - #8805

Merged
rjsparks merged 4 commits into
ietf-tools:mainfrom
jennifer-richards:refactor-test-smtpserver
Apr 21, 2025
Merged

refactor: smtpd->aiosmtpd#8805
rjsparks merged 4 commits into
ietf-tools:mainfrom
jennifer-richards:refactor-test-smtpserver

Conversation

@jennifer-richards

@jennifer-richards jennifer-richards commented Apr 16, 2025

Copy link
Copy Markdown
Member

This is a prerequisite for moving to Python 3.12 (see #7929 (comment)). Fixes #8077

The line_length_limit increase in commit 5bb3700 is needed because, as indicated in the comment, some of the tests are sending messages that exceed the RFC 5321 line length limit in the DATA section. From what I have found so far, the issue is that datatracker is incorrectly sending <LF> instead of <CRLF> as line endings when sending SMTP messages. It's just possible that this is a test-only bug, but it's likely affecting production. This is causing failures now because aiosmtpd is strict, both about line endings and about line lengths, whereas our previous test server was extremely lenient.

While that's embarrassing and should be investigated/fixed soon, I think we should do that separately and run with the line_length_limit fix for now. That only affects testing code and can only cause new failures, not hide ones we'd have caught before.

The test has been working, but in a broken way, for as long as it has existed. The smtpd-based test_smtpserver was masking an exception that did not interfere with the test's effectiveness.
@codecov

codecov Bot commented Apr 16, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.81%. Comparing base (c70e67d) to head (aae841b).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
ietf/utils/test_smtpserver.py 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8805      +/-   ##
==========================================
- Coverage   88.81%   88.81%   -0.01%     
==========================================
  Files         314      314              
  Lines       41255    41430     +175     
==========================================
+ Hits        36642    36795     +153     
- Misses       4613     4635      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jennifer-richards
jennifer-richards marked this pull request as ready for review April 17, 2025 00:39
Comment thread requirements.txt
# -*- conf-mode -*-
setuptools>=51.1.0 # Require this first, to prevent later errors
#
aiosmtpd>=1.4.6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO moving forward, we should try to separate test only dependencies. Not saying we should start with this PR, but better to start somewhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will help us to have clear SBOM for production server.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I like the idea, though have some concerns about how we would validate changes to the production dependency list prior to deployment.

I don't think it's practical to start in this PR because there will be quite a few tooling and deployment adjustments needed regardless of how we do it. It'll need to be its own project.

@rjsparks
rjsparks merged commit 2404263 into ietf-tools:main Apr 21, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor test_smtpserver.py using aiosmtpd

3 participants