Skip to content

Commit

Permalink
Race fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Nov 17, 2023
1 parent 3a2e9ef commit c688e5d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/membership_acls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ func TestAliceBobEncryptionWorks(t *testing.T) {
// -----------------

// login both clients first, so OTKs etc are uploaded.
alice := MustLoginClient(t, clientTypeA, api.FromComplementClient(csapiAlice, "complement-crypto-password"), ss)
defer alice.Close(t)
// We sign in Bob first to try to encourage Alice to get a device list
// update with bob's device keys, which will be important when Alice
// sends the event.
bob := MustLoginClient(t, clientTypeB, api.FromComplementClient(csapiBob, "complement-crypto-password"), ss)
defer bob.Close(t)
alice := MustLoginClient(t, clientTypeA, api.FromComplementClient(csapiAlice, "complement-crypto-password"), ss)
defer alice.Close(t)

// Alice starts syncing
aliceStopSyncing := alice.StartSyncing(t)
Expand Down Expand Up @@ -281,10 +284,11 @@ func TestOnRejoinBobCanSeeButNotDecryptHistoryInPublicRoom(t *testing.T) {
// -----------------

// login both clients first, so OTKs etc are uploaded.
alice := MustLoginClient(t, clientTypeA, api.FromComplementClient(csapiAlice, "complement-crypto-password"), ss)
defer alice.Close(t)
// Similarly to TestAliceBobEncryptionWorks, log Bob in first.
bob := MustLoginClient(t, clientTypeB, api.FromComplementClient(csapiBob, "complement-crypto-password"), ss)
defer bob.Close(t)
alice := MustLoginClient(t, clientTypeA, api.FromComplementClient(csapiAlice, "complement-crypto-password"), ss)
defer alice.Close(t)

// Alice and Bob start syncing. Both are in the same room
aliceStopSyncing := alice.StartSyncing(t)
Expand Down

0 comments on commit c688e5d

Please sign in to comment.