Debian Codegraph @

test/integration/SUMMARY.md

raw
1 # Rspamd Integration Test - Summary
2
3 ## Overview
4
5 Complete integration and load testing infrastructure for Rspamd with Docker Compose.
6
7 ## Features
8
9 ### 1. Complete Rspamd Environment
10 - **Scanner workers** (2x) with encryption
11 - **Controller worker** for API access
12 - **Proxy worker** for request proxying with encryption
13 - **Fuzzy storage** with encrypted connections
14 - **Redis** backend for data storage
15 - **Bayes classifier** for spam detection
16
17 ### 2. AddressSanitizer Integration
18 - **Image**: `rspamd/rspamd:asan-latest`
19 - Detects memory leaks, buffer overflows, use-after-free
20 - Automatic log analysis with `check-asan-logs.sh`
21 - Configurable suppressions via `lsan.supp`
22
23 ### 3. Comprehensive Testing
24 - Downloads email corpus from URL or uses local files
25 - Trains Fuzzy storage (10% of corpus)
26 - Trains Bayes classifier (10% spam + 10% ham)
27 - Scans entire corpus
28 - Validates detection rates (~10% expected)
29 - Tests both controller and proxy workers
30
31 ### 4. High Ports Configuration
32 All services use ports 50000+ to avoid conflicts:
33 - 50001: Scanner workers
34 - 50002: Controller API
35 - 50003: Fuzzy storage
36 - 50004: Proxy worker
37
38 ### 5. Full Encryption
39 - Fuzzy storage: encrypted-only mode
40 - Scanner workers: keypair encryption
41 - Proxy worker: keypair encryption
42 - All keys auto-generated via `generate-keys.sh`
43
44 ## Quick Start
45
46 ```bash
47 cd test/integration
48 make keys # Generate encryption keys
49 make up # Start Docker environment
50 make test # Run integration test
51 make check-asan # Check for memory issues
52 make down # Stop environment
53 ```
54
55 ## Files Created
56
57 ### Configuration
58 - `configs/rspamd.conf` - Main Rspamd configuration
59 - `configs/worker-*.inc` - Worker configurations
60 - `configs/fuzzy_check.conf` - Fuzzy module settings
61 - `configs/redis.conf` - Redis backend
62 - `configs/statistic.conf` - Bayes classifier
63 - `configs/lsan.supp` - LeakSanitizer suppressions
64 - `configs/fuzzy-keys.conf` - Generated encryption keys
65
66 ### Scripts
67 - `scripts/generate-keys.sh` - Generate encryption keys for all workers
68 - `scripts/integration-test.py` - Main test script with training and validation
69 - `scripts/check-asan-logs.sh` - Analyze AddressSanitizer logs
70
71 ### Infrastructure
72 - `docker-compose.yml` - Docker Compose setup with ASan
73 - `Makefile` - Convenient commands
74 - `README.md` - Complete documentation
75 - `.gitignore` - Ignore temporary files
76
77 ## GitHub Actions Workflow
78
79 `.github/workflows/integration-test.yml` provides:
80 - Automated testing on push/PR
81 - Daily scheduled runs
82 - Manual runs with custom corpus URL
83 - ASan log analysis
84 - Artifact uploads (results, logs)
85
86 ## Test Parameters
87
88 ```bash
89 ./scripts/integration-test.py \
90 --corpus-url https://example.com/emails.zip \
91 --rspamd-host localhost \
92 --rspamd-port 50002 \
93 --proxy-port 50004 \
94 --train-ratio 0.1 \
95 --test-proxy \
96 --output results.json
97 ```
98
99 ## Results
100
101 Test outputs:
102 - `data/results.json` - Controller scan results
103 - `data/proxy_results.json` - Proxy scan results (if --test-proxy)
104 - `data/asan.log*` - AddressSanitizer logs
105
106 ## Validation
107
108 The test validates:
109 - Fuzzy detection rate ~10% (±5% tolerance)
110 - Bayes detection rate ~10% (±5% tolerance)
111 - No critical memory issues (via ASan)
112 - Proxy worker functionality
113
114 ## Performance Testing
115
116 To increase load:
117 1. Increase worker count in `configs/worker-normal.inc`
118 2. Use larger email corpus
119 3. Run multiple test instances in parallel
120 4. Adjust timeout and task limits
121
122 ## Memory Safety
123
124 ASan configuration:
125 ```
126 ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:abort_on_error=0:print_stats=1:log_path=/data/asan.log
127 LSAN_OPTIONS=suppressions=/etc/rspamd/lsan.supp:print_suppressions=0
128 ```
129
130 Use `make check-asan` to analyze logs and detect:
131 - Memory leaks
132 - Heap-use-after-free
133 - Heap-buffer-overflow
134 - Double-free
135 - Use-after-return
136
137 ## Next Steps
138
139 1. **Local Testing**: Run `make all` to test locally
140 2. **Custom Corpus**: Provide your own email corpus via `--corpus-url`
141 3. **CI/CD Integration**: Push to trigger GitHub Actions workflow
142 4. **Tune Parameters**: Adjust training ratios, worker counts, timeouts
143 5. **Monitor ASan**: Check logs regularly for memory issues