Fix tests

This commit is contained in:
Till Faelligen 2021-07-31 19:32:38 +02:00
parent 4f204a68d1
commit 167c07bd6f
4 changed files with 14 additions and 7 deletions

View file

@ -504,7 +504,6 @@ func (t *txnReq) processEDUs(ctx context.Context) {
} }
case gomatrixserverlib.MPresence: case gomatrixserverlib.MPresence:
payload := eduserverAPI.FederationPresenceData{} payload := eduserverAPI.FederationPresenceData{}
util.GetLogger(ctx).Debug("%s", e.Content)
if err := json.Unmarshal(e.Content, &payload); err != nil { if err := json.Unmarshal(e.Content, &payload); err != nil {
util.GetLogger(ctx).WithError(err).Error("Failed to unmarshal presence event") util.GetLogger(ctx).WithError(err).Error("Failed to unmarshal presence event")
continue continue

View file

@ -500,6 +500,10 @@ type testUserAPI struct {
accessTokens map[string]userapi.Device accessTokens map[string]userapi.Device
} }
func (u *testUserAPI) QueryPresenceAfter(ctx context.Context, req *userapi.QueryPresenceAfterRequest, res *userapi.QueryPresenceAfterResponse) error {
return nil
}
func (u *testUserAPI) InputPresenceData(ctx context.Context, req *userapi.InputPresenceRequest, res *userapi.InputPresenceResponse) error { func (u *testUserAPI) InputPresenceData(ctx context.Context, req *userapi.InputPresenceRequest, res *userapi.InputPresenceResponse) error {
return nil return nil
} }

View file

@ -343,6 +343,10 @@ type testUserAPI struct {
accessTokens map[string]userapi.Device accessTokens map[string]userapi.Device
} }
func (u *testUserAPI) QueryPresenceAfter(ctx context.Context, req *userapi.QueryPresenceAfterRequest, res *userapi.QueryPresenceAfterResponse) error {
return nil
}
func (u *testUserAPI) InputPresenceData(ctx context.Context, req *userapi.InputPresenceRequest, res *userapi.InputPresenceResponse) error { func (u *testUserAPI) InputPresenceData(ctx context.Context, req *userapi.InputPresenceRequest, res *userapi.InputPresenceResponse) error {
return nil return nil
} }

View file

@ -10,10 +10,10 @@ import (
func TestNewSyncTokenWithLogs(t *testing.T) { func TestNewSyncTokenWithLogs(t *testing.T) {
tests := map[string]*StreamingToken{ tests := map[string]*StreamingToken{
"s4_0_0_0_0_0": { "s4_0_0_0_0_0_0": {
PDUPosition: 4, PDUPosition: 4,
}, },
"s4_0_0_0_0_0.dl-0-123": { "s4_0_0_0_0_0_0.dl-0-123": {
PDUPosition: 4, PDUPosition: 4,
DeviceListPosition: LogPosition{ DeviceListPosition: LogPosition{
Partition: 0, Partition: 0,
@ -42,10 +42,10 @@ func TestNewSyncTokenWithLogs(t *testing.T) {
func TestSyncTokens(t *testing.T) { func TestSyncTokens(t *testing.T) {
shouldPass := map[string]string{ shouldPass := map[string]string{
"s4_0_0_0_0_0": StreamingToken{4, 0, 0, 0, 0, 0, 0, LogPosition{}}.String(), "s4_0_0_0_0_0_0": StreamingToken{4, 0, 0, 0, 0, 0, 0, LogPosition{}}.String(),
"s3_1_0_0_0_0.dl-1-2": StreamingToken{3, 1, 0, 0, 0, 0, 0, LogPosition{1, 2}}.String(), "s3_1_0_0_0_0_0.dl-1-2": StreamingToken{3, 1, 0, 0, 0, 0, 0, LogPosition{1, 2}}.String(),
"s3_1_2_3_5_0": StreamingToken{3, 1, 2, 3, 5, 0, 0, LogPosition{}}.String(), "s3_1_2_3_5_0_0": StreamingToken{3, 1, 2, 3, 5, 0, 0, LogPosition{}}.String(),
"t3_1": TopologyToken{3, 1}.String(), "t3_1": TopologyToken{3, 1}.String(),
} }
for a, b := range shouldPass { for a, b := range shouldPass {