Skip to content

Add test for transferring bans on a room upgrade#563

Merged
anoadragon453 merged 7 commits into
developfrom
anoa/bans_room_upgrade
Mar 11, 2019
Merged

Add test for transferring bans on a room upgrade#563
anoadragon453 merged 7 commits into
developfrom
anoa/bans_room_upgrade

Conversation

@anoadragon453
Copy link
Copy Markdown
Member

@richvdh richvdh requested a review from a team March 7, 2019 09:49
Copy link
Copy Markdown
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, apart from we can use helper functions and we should check in state section

Comment thread tests/30rooms/60version_upgrade.pl Outdated

my $event = first {
$_->{type} eq "m.room.member" && $_->{state_key} eq '@bob:matrix.org',
} @{ $room->{timeline}->{events} };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably check if its in the state section, as that's also a valid place.

On top of that, we can write this entire thing using await_sync_timeline_contains:

await_sync_timeline_contains( $user, $room, check => sub {
    return unless $event->{type} eq "m.room.member";
    return unless $event->{state_key} eq "@bob:matrix.org";

    assert_deeply_eq(
        $event->{content},
        $content,
        "ban in replacement room",
    );

    return 1;
});

Which makes the test a lot shorter, and stops you from having to do the manual syncs.

We will have to create a new await_sync_timeline_or_state_contains function, but that is fairly trivial to do.

Comment thread tests/30rooms/60version_upgrade.pl Outdated
return 1;
});

Future->done(1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, as otherwise you're not using the result of await_sync_timeline_or_state_contains

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah lol. Happy to see that wasn't the reason it passed.

@anoadragon453 anoadragon453 merged commit e9015c6 into develop Mar 11, 2019
@anoadragon453 anoadragon453 deleted the anoa/bans_room_upgrade branch March 11, 2019 10:25
anoadragon453 added a commit that referenced this pull request Mar 13, 2019
…server_specific_tests

* 'develop' of github.com:matrix-org/sytest: (44 commits)
  test endpoint for updating backup versions (#559)
  Add test for transferring bans on a room upgrade (#563)
  fix tests for matrix-org/synapse#2090 (#350)
  Fix typo
  Fixup
  Incorporate review
  Remove prev_state from federation API
  Make the userdir synced not rely on being able to search for yourself (#567)
  Add basic soft fail test
  Check that event_id is given over state fetching over federation (#566)
  Fix registration rate limiting settings
  Fix comments
  Make sytest support auth rate limiting
  Fixup to not send 100 messages
  Test history visibility works for backfill
  Check that Server ACLs are preserved on room upgrade
  Better diagnostics from synapse startup (#561)
  Don't set PYTHONPATH when running synapse (#560)
  Regression test for redactions in room v3 (#558)
  Add test for PDU limit on transactions API (#555)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants