mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
Fix flakey test
This commit is contained in:
parent
d3db542fbf
commit
beea2432e6
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/matrix-org/dendrite/test"
|
"github.com/matrix-org/dendrite/test"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mustCreateInboundpeeksTable(t *testing.T, dbType test.DBType) (tables.FederationInboundPeeks, func()) {
|
func mustCreateInboundpeeksTable(t *testing.T, dbType test.DBType) (tables.FederationInboundPeeks, func()) {
|
||||||
@ -124,11 +125,11 @@ func TestInboundPeeksTable(t *testing.T) {
|
|||||||
if len(inboundPeeks) != len(peekIDs) {
|
if len(inboundPeeks) != len(peekIDs) {
|
||||||
t.Fatalf("inserted %d peeks, selected %d", len(peekIDs), len(inboundPeeks))
|
t.Fatalf("inserted %d peeks, selected %d", len(peekIDs), len(inboundPeeks))
|
||||||
}
|
}
|
||||||
for i := range inboundPeeks {
|
gotPeekIDs := make([]string, 0, len(inboundPeeks))
|
||||||
if inboundPeeks[i].PeekID != peekIDs[i] {
|
for _, p := range inboundPeeks {
|
||||||
t.Fatalf("")
|
gotPeekIDs = append(gotPeekIDs, p.PeekID)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
assert.ElementsMatch(t, gotPeekIDs, peekIDs)
|
||||||
|
|
||||||
// And delete them again
|
// And delete them again
|
||||||
if err = tab.DeleteInboundPeeks(ctx, nil, room.ID); err != nil {
|
if err = tab.DeleteInboundPeeks(ctx, nil, room.ID); err != nil {
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/matrix-org/dendrite/test"
|
"github.com/matrix-org/dendrite/test"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mustCreateOutboundpeeksTable(t *testing.T, dbType test.DBType) (tables.FederationOutboundPeeks, func()) {
|
func mustCreateOutboundpeeksTable(t *testing.T, dbType test.DBType) (tables.FederationOutboundPeeks, func()) {
|
||||||
@ -124,11 +125,11 @@ func TestOutboundPeeksTable(t *testing.T) {
|
|||||||
if len(outboundPeeks) != len(peekIDs) {
|
if len(outboundPeeks) != len(peekIDs) {
|
||||||
t.Fatalf("inserted %d peeks, selected %d", len(peekIDs), len(outboundPeeks))
|
t.Fatalf("inserted %d peeks, selected %d", len(peekIDs), len(outboundPeeks))
|
||||||
}
|
}
|
||||||
for i := range outboundPeeks {
|
gotPeekIDs := make([]string, 0, len(outboundPeeks))
|
||||||
if outboundPeeks[i].PeekID != peekIDs[i] {
|
for _, p := range outboundPeeks {
|
||||||
t.Fatalf("")
|
gotPeekIDs = append(gotPeekIDs, p.PeekID)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
assert.ElementsMatch(t, gotPeekIDs, peekIDs)
|
||||||
|
|
||||||
// And delete them again
|
// And delete them again
|
||||||
if err = tab.DeleteOutboundPeeks(ctx, nil, room.ID); err != nil {
|
if err = tab.DeleteOutboundPeeks(ctx, nil, room.ID); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user