-
Notifications
You must be signed in to change notification settings - Fork 11
253 lines (221 loc) · 7.62 KB
/
Copy pathtests.yaml
File metadata and controls
253 lines (221 loc) · 7.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: CI Tests
permissions:
contents: read
on:
pull_request:
branches: [main]
paths:
- "**.go"
- go.mod
- go.sum
- .github/workflows/**
jobs:
# ============================================================================
# Unit Tests - All Components
# ============================================================================
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: true
- name: Install dependencies
run: make deps
# Database Layer Tests
- name: Test Database Layer
run: |
echo "::group::Database Tests"
go test -v -cover ./internal/db/...
echo "::endgroup::"
# Configuration Tests
- name: Test Configuration
run: |
echo "::group::Configuration Tests"
go test -v ./internal/conf/...
echo "::endgroup::"
# Models Tests
- name: Test Models
run: |
echo "::group::Models Tests"
go test -v ./internal/models/...
echo "::endgroup::"
# Blob Storage Tests
- name: Test Blob Storage
run: |
echo "::group::Blob Storage Tests"
go test -v ./internal/blobstorage/...
echo "::endgroup::"
# IMAP Server Tests - Authentication
- name: Test IMAP Authentication
run: |
echo "::group::IMAP Authentication Tests"
go test -tags=test -coverprofile=auth_coverage.out ./internal/server/auth/...
COVERAGE=$(go tool cover -func=auth_coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "Auth folder coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 80.0" | bc -l) )); then
echo "Error: Auth coverage is below 80% (current: ${COVERAGE}%)"
exit 1
fi
echo "✓ Auth coverage meets target (≥80%)"
echo "::endgroup::"
# IMAP Server Tests - Mailbox Management
- name: Test IMAP Mailbox Management
run: |
echo "::group::IMAP Mailbox Tests"
go test -tags=test -v ./internal/server/mailbox/...
echo "::endgroup::"
# IMAP Server Tests - Message Operations
- name: Test IMAP Message Operations
run: |
echo "::group::IMAP Message Tests"
go test -tags=test -v ./internal/server/message/...
echo "::endgroup::"
# IMAP Server Tests - Extensions
- name: Test IMAP Extensions
run: |
echo "::group::IMAP Extensions Tests"
go test -tags=test -v ./internal/server/extension/...
echo "::endgroup::"
# IMAP Server Tests - Selection & UID
- name: Test Selection & UID Commands
run: |
echo "::group::Selection & UID Tests"
go test -tags=test -v ./internal/server/selection/...
go test -tags=test -v ./internal/server/uid/...
echo "::endgroup::"
# IMAP Server Tests - Core
- name: Test Core IMAP Server
run: |
echo "::group::Core Server Tests"
go test -tags=test -v ./internal/server -run "^Test[^A-Z]"
echo "::endgroup::"
# IMAP Server Tests - Middleware
- name: Test Server Middleware
run: |
echo "::group::Middleware Tests"
go test -tags=test -v ./internal/server/middleware/...
echo "::endgroup::"
# IMAP Server Tests - Utilities
- name: Test Server Utilities
run: |
echo "::group::Server Utilities Tests"
go test -v ./internal/server/utils/...
go test -v ./internal/server/response/...
echo "::endgroup::"
# Delivery Service Tests
- name: Test Delivery Service
run: |
echo "::group::Delivery Service Tests"
go test -tags=test -v ./internal/delivery/...
echo "::endgroup::"
# SASL Authentication Service Tests
- name: Test SASL Authentication Service
run: |
echo "::group::SASL Service Tests"
go test -tags=test -v ./internal/sasl/...
echo "::endgroup::"
# Race Condition Detection
- name: Run Race Detector
run: |
echo "::group::Race Condition Tests"
go test -tags=test -race ./...
echo "::endgroup::"
- name: Test Summary
if: always()
run: |
echo "========================================="
echo "All unit tests completed!"
echo "========================================="
# ============================================================================
# Integration Tests - Cross-Module Testing
# ============================================================================
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: unit-tests # Run integration tests after unit tests pass
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: true
- name: Install dependencies
run: make deps
# Database Integration Tests
- name: Test Database Integration
run: |
echo "::group::Database Integration Tests"
make test-integration-db
echo "::endgroup::"
# IMAP Server Integration Tests
- name: Test IMAP Server Integration
run: |
echo "::group::IMAP Server Integration Tests"
make test-integration-server
echo "::endgroup::"
# LMTP Delivery Integration Tests
- name: Test LMTP Delivery Integration
run: |
echo "::group::LMTP Delivery Integration Tests"
make test-integration-delivery
echo "::endgroup::"
# SASL Authentication Integration Tests
- name: Test SASL Authentication Integration
run: |
echo "::group::SASL Authentication Integration Tests"
make test-integration-sasl
echo "::endgroup::"
# Integration Test Summary
- name: Integration Test Summary
if: always()
run: |
echo "========================================="
echo "All integration tests completed!"
echo "========================================="
# ============================================================================
# End-to-End Tests - Makefile Target
# ============================================================================
e2e_make:
name: E2E (Makefile) Tests
runs-on: ubuntu-latest
needs: integration-tests
timeout-minutes: 40
env:
RAVEN_E2E_CONFIG: test/e2e/config/test.yaml
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
${{ env.GOMODCACHE }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: go mod download
- name: Run E2E (Makefile)
run: |
# Use the project's Makefile target to run the e2e suite
make test-e2e
- name: Upload e2e artifacts (Makefile)
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-artifacts-make
path: |
coverage_e2e.out
coverage_e2e.html
test/e2e/*.log