# Test Configuration Comparison: Rust vs Go ## Overview Two identical test configurations have been created for testing both Rust and Go implementations with the test environment: - **Rust**: `/home/olemd/src/mail2couch/rust/config-test-rust.json` - **Go**: `/home/olemd/src/mail2couch/go/config-test-go.json` ## Configuration Details Both configurations use the **same test environment** from `/home/olemd/src/mail2couch/test/` with: ### Database Connection - **CouchDB URL**: `http://localhost:5984` - **Admin Credentials**: `admin` / `password` ### IMAP Test Server - **Host**: `localhost` - **Port**: `3143` (GreenMail test server) - **Connection**: Plain (no TLS for testing) ### Test Accounts Both configurations use the **same IMAP test accounts**: | Username | Password | Purpose | |----------|----------|---------| | `testuser1` | `password123` | Wildcard all folders test | | `syncuser` | `syncpass` | Work pattern test (sync mode) | | `archiveuser` | `archivepass` | Specific folders test | | `testuser2` | `password456` | Subfolder pattern test (disabled) | ### Mail Sources Configuration Both configurations define **identical mail sources** with only the account names differing: #### 1. Wildcard All Folders Test - **Account Name**: "**Rust** Wildcard All Folders Test" vs "**Go** Wildcard All Folders Test" - **Mode**: `archive` - **Folders**: All folders (`*`) except `Drafts` and `Trash` - **Filters**: Subject keywords: `["meeting", "important"]`, Sender keywords: `["@company.com"]` #### 2. Work Pattern Test - **Account Name**: "**Rust** Work Pattern Test" vs "**Go** Work Pattern Test" - **Mode**: `sync` (delete removed emails) - **Folders**: `Work*`, `Important*`, `INBOX` (exclude `*Temp*`) - **Filters**: Recipient keywords: `["support@", "team@"]` #### 3. Specific Folders Only - **Account Name**: "**Rust** Specific Folders Only" vs "**Go** Specific Folders Only" - **Mode**: `archive` - **Folders**: Exactly `INBOX`, `Sent`, `Personal` - **Filters**: None #### 4. Subfolder Pattern Test (Disabled) - **Account Name**: "**Rust** Subfolder Pattern Test" vs "**Go** Subfolder Pattern Test" - **Mode**: `archive` - **Folders**: `Work/*`, `Archive/*` (exclude `*/Drafts`) - **Status**: `enabled: false` ## Expected Database Names When run, each implementation will create **different databases** due to the account name differences: ### Rust Implementation Databases - `m2c_rust_wildcard_all_folders_test` - `m2c_rust_work_pattern_test` - `m2c_rust_specific_folders_only` - `m2c_rust_subfolder_pattern_test` (disabled) ### Go Implementation Databases - `m2c_go_wildcard_all_folders_test` - `m2c_go_work_pattern_test` - `m2c_go_specific_folders_only` - `m2c_go_subfolder_pattern_test` (disabled) ## Testing Commands ### Start Test Environment ```bash cd /home/olemd/src/mail2couch/test ./start-test-env.sh ``` ### Run Rust Implementation ```bash cd /home/olemd/src/mail2couch/rust cargo build --release ./target/release/mail2couch -c config-test-rust.json ``` ### Run Go Implementation ```bash cd /home/olemd/src/mail2couch/go go build -o mail2couch . ./mail2couch -c config-test-go.json ``` ### Verify Results ```bash # List all databases curl http://localhost:5984/_all_dbs # Check Rust databases curl http://localhost:5984/m2c_rust_wildcard_all_folders_test curl http://localhost:5984/m2c_rust_work_pattern_test curl http://localhost:5984/m2c_rust_specific_folders_only # Check Go databases curl http://localhost:5984/m2c_go_wildcard_all_folders_test curl http://localhost:5984/m2c_go_work_pattern_test curl http://localhost:5984/m2c_go_specific_folders_only ``` ### Stop Test Environment ```bash cd /home/olemd/src/mail2couch/test ./stop-test-env.sh ``` ## Validation Points Both implementations should produce **identical results** when processing the same IMAP accounts: 1. **Database Structure**: Same document schemas and field names 2. **Message Processing**: Same email parsing and storage logic 3. **Folder Filtering**: Same wildcard pattern matching 4. **Message Filtering**: Same keyword filtering behavior 5. **Sync Behavior**: Same incremental sync and deletion handling 6. **Error Handling**: Same retry logic and error recovery The only differences should be: - Database names (due to account name prefixes) - Timestamp precision (implementation-specific) - Internal document IDs format (if any) ## Use Cases ### Feature Parity Testing Run both implementations with the same configuration to verify identical behavior: ```bash # Run both implementations ./test-both-implementations.sh # Compare database contents ./compare-database-results.sh ``` ### Performance Comparison Use identical configurations to benchmark performance differences between Rust and Go implementations. ### Development Testing Use separate configurations during development to avoid database conflicts when testing both implementations simultaneously.