-
Notifications
You must be signed in to change notification settings - Fork 56
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
test to ensure spurious state doesn't leak into incr sync responses when LLing #487
Conversation
…hen LLing tests matrix-org/synapse#3760 regression test for element-hq/element-web#7223
@matrixbot retest this please |
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 plausible modulo some wibbling about the interface to the utility function
tests/10apidoc/09synced.pl
Outdated
@@ -205,7 +205,34 @@ sub await_sync_presence_contains { | |||
} | |||
|
|||
|
|||
push @EXPORT, qw( assert_room_members assert_state_room_members_matches ); | |||
push @EXPORT, qw( assert_room_members assert_state_room_members_matches assert_room_state); |
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.
nice to have: generally it seems helpful to have a push @EXPORT
next to each func being exported, rather than one big one at the top
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.
the codebase is very inconsistent on this, but have moved them.
tests/10apidoc/09synced.pl
Outdated
push @EXPORT, qw( assert_room_members assert_state_room_members_matches ); | ||
push @EXPORT, qw( assert_room_members assert_state_room_members_matches assert_room_state); | ||
|
||
# assert that the state body of a sync response is made up of the given state types. |
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.
nice to have: generally we seem to be using POD for this sort of thing. It'd be nice to be consistent, even if it's slightly more verbose.
tests/10apidoc/09synced.pl
Outdated
|
||
# assert that the state body of a sync response is made up of the given state types. | ||
sub assert_room_state { | ||
my ( $body, $room_id, $state_types ) = @_; |
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.
some docs on what state_types should look like would be helpful, to save people reverse-engineering it.
tests/10apidoc/09synced.pl
Outdated
push @EXPORT, qw( assert_room_members assert_state_room_members_matches assert_room_state); | ||
|
||
# assert that the state body of a sync response is made up of the given state types. | ||
sub assert_room_state { |
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.
this should probably be assert_room_state_types_match
or something, because (a) it only checks for the types, not the whole state, and (b) it checks that they match exactly (as opposed to, for example, being a superset of the desired list)
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.
Also, should it be assert_state_types_match
and take a state block, ie pull lines 214-215 up to the caller, making this equivalent to assert_state_room_members_matches
rather than assert_room_members
? That feels like it would be more intuitive to me.
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.
unconvinced about passing in a random list of state events rather than a sync body response, but whatever; have done so
tests/31sync/15lazy-members.pl
Outdated
@@ -258,7 +267,6 @@ | |||
}); | |||
}; | |||
|
|||
|
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.
nit: this is inconsistent...
@richvdh ptal |
tests/10apidoc/09synced.pl
Outdated
|
||
log_if_fail "Room", $room; | ||
$state_types is an arrayref of arrayrefs, each a tuple of type & state_key. |
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.
an example might have been helpful.
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.
lgtm
retest this please |
tests matrix-org/synapse#3760
regression test for element-hq/element-web#7223