feat: add comprehensive README documentation and clean up configuration

## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples

## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field

## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names

## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud

## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-01 21:26:53 +02:00
commit c2ad55eaaf
17 changed files with 1139 additions and 111 deletions

View file

@ -11,16 +11,17 @@ The test environment provides:
## Quick Start
### Run Full Integration Tests
### Run Basic Integration Tests
```bash
./run-tests.sh
```
This will:
1. Start all containers
2. Populate test data
3. Run mail2couch
4. Verify results
5. Clean up
This comprehensive test will:
1. Start all containers with cleanup
2. Populate test data
3. Build and run mail2couch
4. Verify database creation and document storage
5. Test incremental sync behavior
6. Clean up automatically
### Run Wildcard Pattern Tests
```bash
@ -32,20 +33,56 @@ This will test various wildcard folder patterns including:
- `*/Drafts` (subfolder patterns)
- Complex include/exclude combinations
### Manual Testing
### Run Incremental Sync Tests
```bash
# Start test environment
./test-incremental-sync.sh
```
This will test incremental synchronization functionality:
- First sync establishes baseline
- New messages are added to test accounts
- Second sync should only fetch new messages
- Sync metadata tracking and IMAP SEARCH with SINCE
### Manual Testing Environment
```bash
# Start persistent test environment (for manual experimentation)
./start-test-env.sh
# Run mail2couch manually
# Run mail2couch manually with different configurations
cd ../go
./mail2couch -config ../test/config-test.json
./mail2couch -config ../test/config-wildcard-examples.json
# Stop test environment when done
cd ../test
./stop-test-env.sh
```
## Test Scripts Overview
### Automated Testing (Recommended)
- **`./run-tests.sh`**: Complete integration test with automatic cleanup
- Starts containers, populates data, runs mail2couch, verifies results
- Tests basic functionality, database creation, and incremental sync
- Cleans up automatically - perfect for CI/CD or quick validation
### Specialized Feature Testing
- **`./test-wildcard-patterns.sh`**: Comprehensive folder pattern testing
- Tests `*`, `Work*`, `*/Drafts`, and complex include/exclude patterns
- Self-contained with own setup/teardown
- **`./test-incremental-sync.sh`**: Incremental synchronization testing
- Tests sync metadata tracking and IMAP SEARCH with SINCE
- Multi-step validation: baseline sync → add messages → incremental sync
- Self-contained with own setup/teardown
### Manual Testing Environment
- **`./start-test-env.sh`**: Start persistent test containers
- Keeps environment running for manual experimentation
- Populates test data once
- Use with different configurations for development
- **`./stop-test-env.sh`**: Clean up manual test environment
- Only needed after using `start-test-env.sh`
## Test Accounts
The test environment includes these IMAP accounts:
@ -79,11 +116,11 @@ Each account contains:
## Database Structure
mail2couch will create separate databases for each mail source:
- `wildcard_all_folders_test` - Wildcard All Folders Test (archive mode)
- `work_pattern_test` - Work Pattern Test (sync mode)
- `specific_folders_only` - Specific Folders Only (archive mode)
- `subfolder_pattern_test` - Subfolder Pattern Test (archive mode)
mail2couch will create separate databases for each mail source (with `m2c_` prefix):
- `m2c_wildcard_all_folders_test` - Wildcard All Folders Test (archive mode)
- `m2c_work_pattern_test` - Work Pattern Test (sync mode)
- `m2c_specific_folders_only` - Specific Folders Only (archive mode)
- `m2c_subfolder_pattern_test` - Subfolder Pattern Test (archive mode)
Each database contains documents with:
- `mailbox` field indicating the origin folder
@ -154,17 +191,17 @@ Includes all subfolders under Work and Archive, but excludes any Drafts subfolde
```
test/
├── podman-compose.yml # Container orchestration
├── config-test.json # Main test configuration with wildcard examples
├── podman-compose.yml # Container orchestration (GreenMail + CouchDB)
├── config-test.json # Main test configuration with wildcard examples
├── config-wildcard-examples.json # Advanced wildcard patterns
├── test-wildcard-patterns.sh # Wildcard pattern testing script
├── run-tests.sh # Full integration test
├── start-test-env.sh # Start environment
├── stop-test-env.sh # Stop environment
├── populate-greenmail.py # Create test messages with folders
├── populate-test-messages.sh # Wrapper script
├── dovecot/ # Dovecot configuration (legacy)
└── README.md # This file
├── run-tests.sh # Automated integration test (recommended)
├── test-wildcard-patterns.sh # Specialized wildcard pattern testing
├── test-incremental-sync.sh # Specialized incremental sync testing
├── start-test-env.sh # Start persistent test environment
├── stop-test-env.sh # Stop test environment
├── populate-greenmail.py # Create test messages across multiple folders
├── dovecot/ # Dovecot configuration (legacy, unused)
└── README.md # This file
```
## Prerequisites