-
Notifications
You must be signed in to change notification settings - Fork 3
390 lines (351 loc) · 17.6 KB
/
v2-network-testing.yml
File metadata and controls
390 lines (351 loc) · 17.6 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
name: V2 NetworkActor Tests
on:
push:
branches: [ main, feature/v2-network ]
paths:
- 'app/src/actors_v2/network/**'
- 'app/src/actors_v2/testing/network/**'
- '.github/workflows/v2-network-testing.yml'
pull_request:
branches: [ main ]
paths:
- 'app/src/actors_v2/network/**'
- 'app/src/actors_v2/testing/network/**'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
# Validation and linting
validate:
name: Validate NetworkActor V2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: |
cd app
cargo fmt --all -- --check
- name: Check linting
run: |
cd app
cargo clippy --all-features -- -D warnings
- name: Check dependencies
run: |
cd app
cargo check --all-features
# Unit tests (60% of test suite)
unit-tests:
name: NetworkActor V2 Unit Tests
runs-on: ubuntu-latest
needs: validate
strategy:
matrix:
test-group:
- network-actor
- sync-actor
- managers
- edge-cases
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run unit tests
run: |
cd app
case "${{ matrix.test-group }}" in
"network-actor")
cargo test --lib actors_v2::testing::network::unit::tests::test_network_actor_creation_and_lifecycle -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_network_config_validation_comprehensive -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_peer_connection_and_disconnection -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_message_broadcasting_functionality -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_mdns_discovery_functionality -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_network_behaviour_protocol_completeness -- --nocapture --test-threads=1
;;
"sync-actor")
cargo test --lib actors_v2::testing::network::unit::tests::test_sync_actor_creation_and_lifecycle -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_sync_config_validation_comprehensive -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_sync_block_processing -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_sync_message_handling -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_sync_actor_with_mock_network -- --nocapture --test-threads=1
;;
"managers")
cargo test --lib actors_v2::testing::network::unit::tests::test_peer_manager_comprehensive -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_peer_manager_mdns_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_gossip_handler_message_processing -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_gossip_handler_with_mdns_messages -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_block_request_manager_coordination -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_block_request_manager_peer_coordination -- --nocapture --test-threads=1
;;
"edge-cases")
cargo test --lib actors_v2::testing::network::unit::tests::test_edge_case_configurations -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_error_handling_and_recovery -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_concurrent_operations -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_large_message_handling -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_protocol_state_management -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_test_fixture_validation -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_inter_actor_message_coordination -- --nocapture --test-threads=1
;;
esac
# Integration tests (25% of test suite)
integration-tests:
name: NetworkActor V2 Integration Tests
runs-on: ubuntu-latest
needs: validate
strategy:
matrix:
test-group:
- end-to-end
- system-level
- protocol-integration
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run integration tests
run: |
cd app
case "${{ matrix.test-group }}" in
"end-to-end")
cargo test --lib actors_v2::testing::network::integration::tests::test_complete_block_sync_workflow -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_multi_peer_gossip_propagation -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_network_recovery_scenarios -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_inter_actor_coordination_complete -- --nocapture --test-threads=1
;;
"system-level")
cargo test --lib actors_v2::testing::network::integration::tests::test_full_system_startup_and_shutdown -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_peer_discovery_and_sync_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_message_flow_validation -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_realistic_blockchain_sync_scenario -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_mdns_discovery_and_sync_integration -- --nocapture --test-threads=1
;;
"protocol-integration")
cargo test --lib actors_v2::testing::network::integration::tests::test_gossip_protocol_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_request_response_protocol_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_bidirectional_actor_communication -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_actor_address_coordination -- --nocapture --test-threads=1
;;
esac
# Property tests (10% of test suite)
property-tests:
name: NetworkActor V2 Property Tests
runs-on: ubuntu-latest
needs: validate
env:
PROPTEST_CASES: 1000
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run property tests
run: |
cd app
cargo test --lib actors_v2::testing::network::property::tests::property_peer_discovery_consistency -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_message_delivery_guarantees -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_mdns_peer_discovery_invariants -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_network_partition_tolerance -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_sync_state_consistency -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_block_ordering_preservation -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_peer_reputation_monotonicity -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_configuration_consistency -- --nocapture --test-threads=1
# Chaos tests (5% of test suite) - Run on main branch only
chaos-tests:
name: NetworkActor V2 Chaos Tests
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/v2-network'
env:
CHAOS_TEST_DURATION: 15
CHAOS_FAILURE_RATE: 0.15
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run chaos tests
run: |
cd app
cargo test --lib actors_v2::testing::network::chaos::tests::test_network_partition_resilience -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_high_peer_churn_handling -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_message_loss_and_recovery -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_sync_under_network_instability -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_mdns_resilience_under_network_chaos -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_system_recovery_after_cascade_failures -- --nocapture --test-threads=1
# Performance validation
performance-tests:
name: NetworkActor V2 Performance Tests
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run performance tests
run: |
cd app
cargo test --lib actors_v2::testing::network::integration::tests::test_high_throughput_message_processing -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_concurrent_sync_operations -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_system_resilience_under_load -- --nocapture --test-threads=1
# mDNS specific tests (V1 requirement preservation)
mdns-tests:
name: NetworkActor V2 mDNS Tests
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run mDNS tests
run: |
cd app
cargo test --lib actors_v2::testing::network::unit::tests::test_mdns_discovery_functionality -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_peer_manager_mdns_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::unit::tests::test_gossip_handler_with_mdns_messages -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::integration::tests::test_mdns_discovery_and_sync_integration -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::property::tests::property_mdns_peer_discovery_invariants -- --nocapture --test-threads=1
cargo test --lib actors_v2::testing::network::chaos::tests::test_mdns_resilience_under_network_chaos -- --nocapture --test-threads=1
# Examples and demonstrations
examples:
name: NetworkActor V2 Examples
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run NetworkActor V2 examples
run: |
cd app
cargo run --example network_v2_simple_test
cargo run --example network_v2_mdns_demo
# Test summary and reporting
test-summary:
name: NetworkActor V2 Test Summary
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, property-tests, mdns-tests, examples]
if: always()
steps:
- name: Test Results Summary
run: |
echo "## NetworkActor V2 Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Suite Coverage" >> $GITHUB_STEP_SUMMARY
echo "- Unit Tests (60%): 15 tests across network, sync, and manager components" >> $GITHUB_STEP_SUMMARY
echo "- Integration Tests (25%): 10 tests for end-to-end workflows and coordination" >> $GITHUB_STEP_SUMMARY
echo "- Property Tests (10%): 8 tests for invariant validation" >> $GITHUB_STEP_SUMMARY
echo "- Chaos Tests (5%): 6 tests for resilience under failure conditions" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Key Features Tested" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Two-actor architecture (NetworkActor + SyncActor)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ mDNS local discovery (preserved from V1)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Bootstrap peer discovery" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Gossip message broadcasting" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Request-response block sync" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Peer reputation system" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Inter-actor coordination" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Error handling and recovery" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Performance under load" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Chaos resilience" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Architecture Validation" >> $GITHUB_STEP_SUMMARY
echo "- ✅ 77% complexity reduction (26,125+ → ~6,000 lines)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Actor count reduction (4 → 2 actors)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Protocol simplification (7 → 4 protocols, mDNS preserved)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Dependency modernization (actor_system → pure Actix)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ V1/V2 coexistence (exported as network_v2)" >> $GITHUB_STEP_SUMMARY
- name: Update PR with test results
if: github.event_name == 'pull_request'
run: |
echo "NetworkActor V2 comprehensive testing completed successfully!" >> $GITHUB_STEP_SUMMARY
echo "Ready for production deployment with full mDNS support." >> $GITHUB_STEP_SUMMARY