mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Ignore order of state events for this test as RespState.Events is non-deterministic
This commit is contained in:
parent
ecb574b490
commit
5b71fcc6c5
|
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -527,5 +529,23 @@ func TestTransactionFetchMissingStateByFallbackState(t *testing.T) {
|
|||
mustProcessTransaction(t, txn, nil)
|
||||
// the roomserver should get all state events and the new input event
|
||||
// TODO: it should really be only giving the missing ones
|
||||
assertInputRoomEvents(t, rsAPI.inputRoomEvents, append(stateEvents, inputEvent))
|
||||
got := rsAPI.inputRoomEvents
|
||||
if len(got) != len(stateEvents)+1 {
|
||||
t.Fatalf("wrong number of InputRoomEvents: got %d want %d", len(got), len(stateEvents)+1)
|
||||
}
|
||||
last := got[len(got)-1]
|
||||
if last.Event.EventID() != inputEvent.EventID() {
|
||||
t.Errorf("last event should be the input event but it wasn't. got %s want %s", last.Event.EventID(), inputEvent.EventID())
|
||||
}
|
||||
gots := make([]string, len(stateEvents))
|
||||
wants := make([]string, len(stateEvents))
|
||||
for i := range stateEvents {
|
||||
gots[i] = got[i].Event.EventID()
|
||||
wants[i] = stateEvents[i].EventID()
|
||||
}
|
||||
sort.Strings(gots)
|
||||
sort.Strings(wants)
|
||||
if !reflect.DeepEqual(gots, wants) {
|
||||
t.Errorf("state events returned mismatch, got (sorted): %+v want %+v", gots, wants)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue