-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'Outbound federation will ignore a missing event with bad JSON for room version 6' #1061
Conversation
…r room version 6' We can't assume that homeservers will process inbound federation events synchronously.
->then( sub { | ||
my ( $req ) = @_; | ||
my $body = $req->body_from_json; | ||
|
||
log_if_fail "Second /get_missing_events body", $body; | ||
|
||
log_if_fail "Send response", $body; | ||
assert_json_list( my $earliest = $body->{earliest_events} ); | ||
@$earliest == 1 or | ||
die "Expected a single 'earliest_event' ID"; | ||
|
||
assert_json_keys( $body, 'pdus' ); | ||
# 'pdus' is a map from event id to error details. | ||
my $pdus = $body->{pdus}; | ||
# It is expected that the earliest event is the m.room.member event, | ||
# but it is possible that the caches have not yet been invalidated | ||
# so also allow any of that event's previous events. | ||
my @expected = @{$latest_event->{prev_events}}; | ||
push( @expected, $room->id_for_event( $latest_event ) ); | ||
assert_ok( any { $earliest->[0] eq $_ } @expected, | ||
"'earliest_events' did not match" ); | ||
|
||
# Sending the event fails since fetching the event results in | ||
# invalid JSON, thus we expect an error for the sent PDU. | ||
assert_json_keys( $pdus, $sent_event_id ); | ||
assert_json_keys( $pdus->{$sent_event_id}, qw( error ) ); | ||
assert_json_list( my $latest = $body->{latest_events} ); | ||
@$latest == 1 or | ||
die "Expected a single 'latest_events' ID"; | ||
assert_eq( $latest->[0], $marker_event_id, | ||
'latest_events[0]' ); | ||
|
||
Future->done; | ||
}), | ||
); | ||
$req->respond_json( { | ||
events => [ $sent_event ], | ||
} ); | ||
|
||
Future->done; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is a cut and paste of the earlier code, let's factor it out to a separate sub
?
do we even still need this test, given it has been ported to complement? |
FTR we decided we do want to keep the test here, at least until we can add worker mode to complement and add it to CI |
Co-authored-by: Richard van der Hoff <[email protected]>
73eb982
to
13029d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks generally plausible, modulo CI being borked
... now that it has been fixed in matrix-org/sytest#1061.
…r room version 6' (#152) This test got blacklisted for the release of Synapse 1.37.1. We can't assume that homeservers will process inbound federation events synchronously. In this particular case we replace the check for errors in /send response with a check that if we send a new event that references the expected rejected event we'll see a request for that event come in. c.f. matrix-org/synapse#10275 and matrix-org/sytest#1061
... now that it has been fixed in matrix-org/sytest#1061.
We can't assume that homeservers will process inbound federation events synchronously.
In this particular case we replace the check for errors in
/send
response with a check that if we send a new event that references the expected rejected event we'll see a request for that event come in.c.f. matrix-org/synapse#10275