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

Retry /whois to allow for propagation/persistence delay #1222

Merged
merged 7 commits into from
Apr 1, 2022
Merged
Changes from 1 commit
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
38 changes: 21 additions & 17 deletions tests/48admin.pl
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,34 @@ sub await_purge_complete {
# tightly control the actions taken by that user.
# Conceivably this API may change based on the number of API calls the
# user made, for instance.

matrix_register_user( $http, "admin" )
->then( sub {
( $user ) = @_;

do_request_json_for( $user,
method => "GET",
uri => "/v3/admin/whois/".$user->user_id,
)
})->then( sub {
my ( $body ) = @_;
retry_until_success {
sleep 1;
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
do_request_json_for( $user,
method => "GET",
uri => "/v3/admin/whois/".$user->user_id,
)->then( sub {
my ( $body ) = @_;

assert_json_keys( $body, qw( devices user_id ) );
assert_eq( $body->{user_id}, $user->user_id, "user_id" );
assert_json_object( $body->{devices} );
assert_json_keys( $body, qw( devices user_id ) );
assert_eq( $body->{user_id}, $user->user_id, "user_id" );
assert_json_object( $body->{devices} );

foreach my $value ( values %{ $body->{devices} } ) {
assert_json_keys( $value, "sessions" );
assert_json_list( $value->{sessions} );
assert_json_keys( $value->{sessions}[0], "connections" );
assert_json_list( $value->{sessions}[0]{connections} );
assert_json_keys( $value->{sessions}[0]{connections}[0], qw( ip last_seen user_agent ) );
}
foreach my $value ( values %{ $body->{devices} } ) {
assert_json_keys( $value, "sessions" );
assert_json_list( $value->{sessions} );
assert_json_keys( $value->{sessions}[0], "connections" );
assert_json_list( $value->{sessions}[0]{connections} );
assert_json_keys( $value->{sessions}[0]{connections}[0], qw( ip last_seen user_agent ) );
}

Future->done( 1 );
Future->done( 1 );
});
}
});
};

Expand Down