Skip to content

Commit

Permalink
fixup! test: Test that room keys received by notification clients tri…
Browse files Browse the repository at this point in the history
…gger redecryptions
  • Loading branch information
poljar committed Dec 17, 2024
1 parent cbdfb27 commit d0ac6dd
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions testing/matrix-sdk-integration-testing/src/tests/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ async fn test_enabling_backups_retries_decryption() {
}

#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_foobar() {
async fn test_room_keys_received_on_notification_client_trigger_redecryption() {
let alice = TestClientBuilder::new("alice").use_sqlite().build().await.unwrap();
alice.encryption().wait_for_e2ee_initialization_tasks().await;

Expand Down Expand Up @@ -562,12 +562,23 @@ async fn test_foobar() {
let timeline =
bob_room.timeline().await.expect("We should be able to get a timeline for our room");

timeline
.paginate_backwards(50)
.await
.expect("We should be able to paginate the timeline to fetch the history");
let item =
timeline.item_by_event_id(&event_id).await.expect("The event should be in the timeline");
let mut item = None;

for _ in 0..2 {
timeline
.paginate_backwards(50)
.await
.expect("We should be able to paginate the timeline to fetch the history");

if let Some(timeline_item) = timeline.item_by_event_id(&event_id).await {
item = Some(timeline_item);
break;
} else {
sleep(Duration::from_millis(100)).await
}
}

let item = item.expect("The event should be in the timeline by now");

// The event is not decrypted yet.
assert_matches!(item.content(), TimelineItemContent::UnableToDecrypt(_));
Expand Down

0 comments on commit d0ac6dd

Please sign in to comment.