@@ -4276,4 +4276,41 @@ pub(crate) mod test {
4276
4276
assert_eq ! ( up. deferred_ops. len( ) , 2 ) ;
4277
4277
assert_eq ! ( up. deferred_msgs. len( ) , 0 ) ;
4278
4278
}
4279
+
4280
+ /// What happens when a guest submits a read after three downstairs have
4281
+ /// faulted?
4282
+ #[ tokio:: test]
4283
+ async fn three_faulted_downstairs_read ( ) {
4284
+ let mut up = make_upstairs ( ) ;
4285
+ up. force_active ( ) . unwrap ( ) ;
4286
+ set_all_active ( & mut up. downstairs ) ;
4287
+
4288
+ up. downstairs . clients [ ClientId :: new ( 0 ) ]
4289
+ . checked_state_transition ( & UpstairsState :: Active , DsState :: Faulted ) ;
4290
+ up. downstairs . clients [ ClientId :: new ( 1 ) ]
4291
+ . checked_state_transition ( & UpstairsState :: Active , DsState :: Faulted ) ;
4292
+ up. downstairs . clients [ ClientId :: new ( 2 ) ]
4293
+ . checked_state_transition ( & UpstairsState :: Active , DsState :: Faulted ) ;
4294
+
4295
+ let data = Buffer :: new ( 1 , 512 ) ;
4296
+ let offset = BlockIndex ( 7 ) ;
4297
+ let ( res, done) = BlockOpWaiter :: pair ( ) ;
4298
+ up. apply ( UpstairsAction :: Guest ( BlockOp :: Read { offset, data, done } ) ) ;
4299
+
4300
+ let reply = res. wait_raw ( ) . await . unwrap ( ) ;
4301
+ match reply {
4302
+ // Alan says "If none of the reads returned, then the guest had
4303
+ // better get an error."
4304
+ Err ( ( _, _) ) => {
4305
+ // ok!
4306
+ }
4307
+
4308
+ Ok ( _) => {
4309
+ // Alan says "If we return OK, then what data are we giving the
4310
+ // guest?"
4311
+ eprintln ! ( "{reply:?}" ) ;
4312
+ panic ! ( "returned Ok!" ) ;
4313
+ }
4314
+ }
4315
+ }
4279
4316
}
0 commit comments