File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -857,6 +857,8 @@ impl Context {
857857 ///
858858 /// This should only be used by test code and during configure.
859859 pub ( crate ) async fn set_primary_self_addr ( & self , primary_new : & str ) -> Result < ( ) > {
860+ self . quota . write ( ) . await . take ( ) ;
861+
860862 // add old primary address (if exists) to secondary addresses
861863 let mut secondary_addrs = self . get_all_self_addrs ( ) . await ?;
862864 // never store a primary address also as a secondary
@@ -869,7 +871,7 @@ impl Context {
869871
870872 self . set_config_internal ( Config :: ConfiguredAddr , Some ( primary_new) )
871873 . await ?;
872-
874+ self . emit_event ( EventType :: ConnectivityChanged ) ;
873875 Ok ( ( ) )
874876 }
875877
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ mod tests {
197197 }
198198
199199 #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
200- async fn test_quota_needs_update ( ) {
200+ async fn test_quota_needs_update ( ) -> Result < ( ) > {
201201 let mut tcm = TestContextManager :: new ( ) ;
202202 let t = & tcm. unconfigured ( ) . await ;
203203 const TIMEOUT : u64 = 60 ;
@@ -214,5 +214,14 @@ mod tests {
214214 modified : tools:: Time :: now ( ) ,
215215 } ) ;
216216 assert ! ( !t. quota_needs_update( TIMEOUT ) . await ) ;
217+
218+ t. evtracker . clear_events ( ) ;
219+ t. set_primary_self_addr ( "new@addr" ) . await ?;
220+ assert ! ( t. quota. read( ) . await . is_none( ) ) ;
221+ t. evtracker
222+ . get_matching ( |evt| matches ! ( evt, EventType :: ConnectivityChanged ) )
223+ . await ;
224+ assert ! ( t. quota_needs_update( TIMEOUT ) . await ) ;
225+ Ok ( ( ) )
217226 }
218227}
You can’t perform that action at this time.
0 commit comments