Skip to content

Commit

Permalink
test configuration race
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Laux committed Oct 29, 2024
1 parent 247597b commit 43f5813
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/events/account_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ mod test {
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_configuration_race() -> Result<()> {
let mut tcm = TestContextManager::new();
let test_context = tcm.unconfigured().await;
let context = test_context.clone();
let configure_handle =
tokio::spawn(async move { test_context.configure_addr("[email protected]").await });

// TODO online test - real configuration - otherwise we won't reproduce the race.

assert!(!context.is_configured().await?);
EventTracker::new(context.get_event_emitter())
.get_matching(|evt| matches!(evt, EventType::AccountsItemChanged))
.await;
assert!(context.is_configured().await?);

configure_handle.await?;
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_set_displayname() -> Result<()> {
let mut tcm = TestContextManager::new();
Expand Down

0 comments on commit 43f5813

Please sign in to comment.