Skip to content

Add container-based E2E tests for SMTP and IMAP#147

Merged
linyows merged 2 commits intomainfrom
add-smtp-imap-e2e-tests
Jan 13, 2026
Merged

Add container-based E2E tests for SMTP and IMAP#147
linyows merged 2 commits intomainfrom
add-smtp-imap-e2e-tests

Conversation

@linyows
Copy link
Owner

@linyows linyows commented Jan 13, 2026

Summary

Added E2E tests using Docker containers for SMTP and IMAP, following the same pattern as existing HTTP, MySQL, PostgreSQL, and SSH tests.

Changes

SMTP E2E Testing

  • Added Mailpit container (v1.28) for SMTP testing
    • Port 1025: SMTP server
    • Port 8025: Web UI and API for health checks
  • New jobs in testdata/verify-examples.yml:
    • SMTP Server Start: Launches Mailpit container
    • SMTP Workflow Tests: Runs examples/smtp.yml

IMAP E2E Testing

  • Added Greenmail container (v2.1.0) for IMAP testing
    • Supports SMTP, IMAP, and POP3
    • Ports: 3025 (SMTP), 3143 (IMAP), 3993 (IMAPS), 8080 (API)
  • Enhanced examples/imap.yml:
    • Added variables: mail_to, tls_enabled, skip_search_tests
    • Added SMTP step to send test emails before IMAP operations
    • Added skipif conditions for Greenmail compatibility
  • New jobs in testdata/verify-examples.yml:
    • IMAP Server Start: Launches Greenmail container
    • IMAP Workflow Tests: Runs examples/imap.yml

Technical Details

Why Greenmail for IMAP?

  • Greenmail supports SMTP, IMAP, and POP3 in a single container
  • Lightweight and fast startup for E2E testing
  • Known limitation: UID SEARCH command is not supported
    • Tests using UID SEARCH are skipped when SKIP_SEARCH_TESTS=true
    • Basic IMAP operations (List, Select, Fetch) are fully tested

Test Environment Configuration

  • SMTP: Uses Mailpit for dedicated SMTP testing
  • IMAP: Uses Greenmail with TLS disabled to avoid certificate verification issues
  • Pre-populates mailbox with test emails before IMAP operations
  • 1-second wait after email sending to ensure server-side processing completes

Test Plan

E2E tests verify:

  • ✅ SMTP: Email sending with various configurations
  • ✅ IMAP: Login, mailbox operations, message retrieval
  • ✅ Integration: SMTP → IMAP flow (send emails, then retrieve via IMAP)

🤖 Generated with Claude Code

Added E2E tests using Docker containers to verify SMTP and IMAP functionality,
following the same pattern as existing HTTP, MySQL, PostgreSQL, and SSH tests.

Changes:
- Added Mailpit container for SMTP E2E testing (port 1025)
- Added Greenmail container for IMAP E2E testing (ports 3025, 3143, 3993, 8080)
- Updated examples/imap.yml to support test environment setup:
  - Added mail_to, tls_enabled, skip_search_tests variables
  - Added SMTP step to send test emails before IMAP operations
  - Added skipif conditions for Greenmail compatibility (UID SEARCH not supported)
- Updated testdata/verify-examples.yml with new test jobs:
  - SMTP Server Start and SMTP Workflow Tests
  - IMAP Server Start and IMAP Workflow Tests

Technical details:
- SMTP uses Mailpit for lightweight testing
- IMAP uses Greenmail which supports SMTP, IMAP, and POP3
- IMAP tests skip UID SEARCH commands (not supported by Greenmail)
- Uses TLS=false for IMAP tests to avoid certificate verification issues

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Port 8080 was already used by the HTTP test server (httpbin container).
Changed Greenmail's API port mapping from 8080:8080 to 8081:8080 to avoid
conflict when both jobs run in parallel.
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link

Code Metrics Report

main (8b24287) #147 (428695b) +/-
Coverage 48.7% 48.7% 0.0%
Code to Test Ratio 1:1.1 1:1.1 0.0
Test Execution Time 8s 24s +16s
Details
  |                     | main (8b24287) | #147 (428695b) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          48.7% |          48.7% | 0.0% |
  |   Files             |             52 |             52 |    0 |
  |   Lines             |           5249 |           5249 |    0 |
  |   Covered           |           2560 |           2560 |    0 |
  | Code to Test Ratio  |          1:1.1 |          1:1.1 |  0.0 |
  |   Code              |          10573 |          10573 |    0 |
  |   Test              |          12109 |          12109 |    0 |
- | Test Execution Time |             8s |            24s | +16s |

Reported by octocov

@linyows linyows merged commit 6cbafc0 into main Jan 13, 2026
7 checks passed
@linyows linyows deleted the add-smtp-imap-e2e-tests branch January 13, 2026 03:20
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.

1 participant