Skip to content

Commit 54edc13

Browse files
committed
edge testing for aeron
1 parent 80b42ab commit 54edc13

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

core/src/distributed/aeron_publish.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ pub async fn run(context: SteadyContext
2525
, aeron:Arc<futures_util::lock::Mutex<Aeron>>
2626
, state: SteadyState<AeronPublishSteadyState>) -> Result<(), Box<dyn Error>> {
2727

28-
internal_behavior(context.into_monitor([&rx], [])
29-
, rx, aeron_connect, stream_id, aeron, state).await
28+
let cmd = context.into_monitor([&rx], []);
29+
if cfg!(not(test)) {
30+
internal_behavior(cmd, rx, aeron_connect, stream_id, aeron, state).await
31+
} else {
32+
cmd.simulated_behavior(vec!(&TestEquals(rx))).await
33+
}
34+
3035
}
3136

3237
async fn internal_behavior<C: SteadyCommander>(mut cmd: C

core/src/distributed/aeron_subscribe.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ pub async fn run(context: SteadyContext
2929
, stream_id: i32
3030
, aeron:Arc<futures_util::lock::Mutex<Aeron>>
3131
, state: SteadyState<AeronSubscribeSteadyState>) -> Result<(), Box<dyn Error>> {
32-
internal_behavior(context.into_monitor([], [&tx])
33-
, tx, aeron_connect, stream_id, aeron, state).await
32+
let cmd = context.into_monitor([], [&tx]);
33+
if cfg!(not(test)) {
34+
internal_behavior(cmd, tx, aeron_connect, stream_id, aeron, state).await
35+
} else {
36+
cmd.simulated_behavior(vec!(&TestEcho(tx))).await
37+
}
3438
}
35-
3639
async fn internal_behavior<C: SteadyCommander>(mut cmd: C
3740
, tx: SteadyStreamTx<StreamSessionMessage>
3841
, aeron_channel: Channel

core/src/distributed/aeron_subscribe_bundle.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ pub async fn run<const GIRTH:usize,>(context: SteadyContext
3232
, stream_id: i32
3333
, aeron:Arc<futures_util::lock::Mutex<Aeron>>
3434
, state: SteadyState<AeronSubscribeSteadyState>) -> Result<(), Box<dyn Error>> {
35-
internal_behavior(context.into_monitor([], tx.control_meta_data()), tx, aeron_connect, stream_id, aeron, state).await
35+
36+
let cmd = context.into_monitor([], tx.control_meta_data());
37+
if cfg!(not(test)) {
38+
internal_behavior(cmd, tx, aeron_connect, stream_id, aeron, state).await
39+
} else {
40+
let te:Vec<_> = tx.iter()
41+
.map(|f| TestEcho(f.clone()) ).collect();
42+
let sims:Vec<_> = te.iter()
43+
.map(|f| f as &dyn IntoSimRunner<_>).collect();
44+
cmd.simulated_behavior(sims).await
45+
}
3646
}
3747

3848
//

0 commit comments

Comments
 (0)