@@ -64,6 +64,8 @@ func TestBackfillingHistory(t *testing.T) {
6464
6565 virtualUserLocalpart := "maria"
6666 virtualUserID := fmt .Sprintf ("@%s:hs1" , virtualUserLocalpart )
67+ // Register and join the virtual user
68+ ensureVirtualUserRegistered (t , as , virtualUserLocalpart )
6769
6870 t .Run ("parallel" , func (t * testing.T ) {
6971 // Test that the message events we insert between A and B come back in the correct order from /messages
@@ -100,9 +102,6 @@ func TestBackfillingHistory(t *testing.T) {
100102 // inserted history later.
101103 eventIDsAfter := createMessagesInRoom (t , alice , roomID , 2 )
102104
103- // Register and join the virtual user
104- ensureVirtualUserRegistered (t , as , virtualUserLocalpart )
105-
106105 // Insert the most recent chunk of backfilled history
107106 batchSendRes := batchSendHistoricalMessages (
108107 t ,
@@ -198,9 +197,13 @@ func TestBackfillingHistory(t *testing.T) {
198197 eventIdBefore := eventIDsBefore [0 ]
199198 timeAfterEventBefore := time .Now ()
200199
201- // Insert a backfilled event
200+ // Register and join the other virtual users
202201 virtualUserID2 := "@ricky:hs1"
202+ ensureVirtualUserRegistered (t , as , "ricky" )
203203 virtualUserID3 := "@carol:hs1"
204+ ensureVirtualUserRegistered (t , as , "carol" )
205+
206+ // Insert a backfilled event
204207 batchSendRes := batchSendHistoricalMessages (
205208 t ,
206209 as ,
@@ -343,9 +346,6 @@ func TestBackfillingHistory(t *testing.T) {
343346 // eventIDsAfter
344347 createMessagesInRoom (t , alice , roomID , 3 )
345348
346- // Register and join the virtual user
347- ensureVirtualUserRegistered (t , as , virtualUserLocalpart )
348-
349349 batchSendRes := batchSendHistoricalMessages (
350350 t ,
351351 as ,
@@ -402,9 +402,6 @@ func TestBackfillingHistory(t *testing.T) {
402402 "limit" : []string {"5" },
403403 }))
404404
405- // Register and join the virtual user
406- ensureVirtualUserRegistered (t , as , virtualUserLocalpart )
407-
408405 batchSendRes := batchSendHistoricalMessages (
409406 t ,
410407 as ,
@@ -451,9 +448,6 @@ func TestBackfillingHistory(t *testing.T) {
451448 // eventIDsAfter
452449 createMessagesInRoom (t , alice , roomID , 3 )
453450
454- // Register and join the virtual user
455- ensureVirtualUserRegistered (t , as , virtualUserLocalpart )
456-
457451 // Mimic scrollback to all of the messages
458452 // scrollbackMessagesRes
459453 remoteCharlie .MustDoFunc (t , "GET" , []string {"_matrix" , "client" , "r0" , "rooms" , roomID , "messages" }, client .WithContentType ("application/json" ), client .WithQueries (url.Values {
0 commit comments