Skip to content
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

Tweak send_and_await_outlier to send membership first #1302

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions tests/50federation/00prepare.pl
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,30 @@ =head2 send_and_await_outlier
sub send_and_await_outlier {
my ( $inbound_server, $outbound_client, $room, $sending_user_id, $receiving_user ) = @_;

# to construct an outlier, we create three events, Q, R, S.
# to construct an outlier, we create four three events, P, Q, R, S.
#
# We send S over federation, and allow the server to backfill R, leaving
# the server with a gap in the dag. It therefore requests the state at Q,
# P is the membership event which we need to auth other events, so we send
# that first. Then we send S over federation, and allow the server to backfill R,
# leaving the server with a gap in the dag. It therefore requests the state at Q,
# which leads to Q being persisted as an outlier.

my $first_home_server = $receiving_user->server_name;
my $room_id = $room->room_id;
my %initial_room_state = %{ $room->{current_state} };

my ( $outlier_event_Q, $outlier_event_id_Q ) = $room->create_and_insert_event(
my ( $membership_event_P, $membership_event_id_P ) = $room->create_and_insert_event(
type => 'm.room.member',
sender => $sending_user_id,
state_key => $sending_user_id,
content => { membership => 'join' },
);

my ( $outlier_event_Q, $outlier_event_id_Q ) = $room->create_and_insert_event(
type => "m.room.message",
sender => $sending_user_id,
content => { body => "state-requested event Q" },
);

my ( $backfilled_event_R, $backfilled_event_id_R ) = $room->create_and_insert_event(
type => "m.room.message",
sender => $sending_user_id,
Expand All @@ -271,11 +278,17 @@ sub send_and_await_outlier {
content => { body => "sent event S" },
);

log_if_fail "create_outlier_event: events Q, R, S", [ $outlier_event_id_Q, $backfilled_event_id_R, $sent_event_id_S ];
log_if_fail "create_outlier_event: events P, Q, R, S", [ $membership_event_id_P, $outlier_event_id_Q, $backfilled_event_id_R, $sent_event_id_S ];

my $state_req_fut;

Future->needs_all(
# send P
$outbound_client->send_event(
event => $membership_event_P,
destination => $first_home_server,
),

# send S
$outbound_client->send_event(
event => $sent_event_S,
Expand Down