Skip to content

Commit 3d09f94

Browse files
squahtxrichvdh
andauthored
Add more tests for receiving events while resyncing for a partial join (#419)
And add some helper functions along the way: * Factor out a `CreateMessageEvent()` helper. * Add `testReceiveEventDuringPartialStateJoin()`, which sends an event over federation, checks that a client can see it and checks the state at the event. * Add `handleGetMissingEventsRequests()` to respond to `/get_missing_events` requests. * Add a `Context` parameter to `SendFederationRequest()`, to allow custom timeouts to be specified. Co-authored-by: Richard van der Hoff <[email protected]>
1 parent 6d5c75f commit 3d09f94

File tree

3 files changed

+285
-69
lines changed

3 files changed

+285
-69
lines changed

internal/federation/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (s *Server) MustSendTransaction(t *testing.T, deployment *docker.Deployment
213213
// SendFederationRequest signs and sends an arbitrary federation request from this server.
214214
//
215215
// The requests will be routed according to the deployment map in `deployment`.
216-
func (s *Server) SendFederationRequest(deployment *docker.Deployment, req gomatrixserverlib.FederationRequest, resBody interface{}) error {
216+
func (s *Server) SendFederationRequest(ctx context.Context, deployment *docker.Deployment, req gomatrixserverlib.FederationRequest, resBody interface{}) error {
217217
if err := req.Sign(gomatrixserverlib.ServerName(s.serverName), s.KeyID, s.Priv); err != nil {
218218
return err
219219
}
@@ -224,7 +224,7 @@ func (s *Server) SendFederationRequest(deployment *docker.Deployment, req gomatr
224224
}
225225

226226
httpClient := gomatrixserverlib.NewClient(gomatrixserverlib.WithTransport(&docker.RoundTripper{Deployment: deployment}))
227-
return httpClient.DoRequestAndParseResponse(context.Background(), httpReq, resBody)
227+
return httpClient.DoRequestAndParseResponse(ctx, httpReq, resBody)
228228
}
229229

230230
// MustCreateEvent will create and sign a new latest event for the given room.

0 commit comments

Comments
 (0)