Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
5 changes: 0 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ some configuration output, rather than an error::
$ pkg-config --libs libsodium
-L/usr/local/Cellar/libsodium/1.0.8/lib -lsodium

It's possible that Crypt::NaCL::Sodium has got out of sync with brew's libsodium,
causing errors about aes128ctr, which was removed in 1.0.8.1 of libsodium.
In which case you may want to strip out the aes128ctr stuff from Sodium.xs to
get it to install... :/

Then force an install of Crypt::NaCl::Sodium::

$ cpan
Expand Down
3 changes: 2 additions & 1 deletion lib/SyTest/Homeserver/Dendrite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ sub _check_db_config
my $self = shift;
my ( %config ) = @_;

$config{type} eq "pg" or die "Dendrite can only run against postgres";
# We're in the business of running sytest against dendrite+sqlite these days
#$config{type} eq "pg" or die "Dendrite can only run against postgres";

return $self->SUPER::_check_db_config( @_ );
}
Expand Down
2 changes: 1 addition & 1 deletion lib/SyTest/Homeserver/ProcessManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ sub _await_ready_notification
# We replace null byte with '@' to allow us to pass it in via env. (This is
# as per the sd_notify spec).
my $path_env = $path;
$path_env =~ s/\0/\@/rg;
$path_env =~ s/\0/\@/g;
$env->{"NOTIFY_SOCKET"} = $path_env;

# Create a future that gets resolved when we receive a `READY=1`
Expand Down
2 changes: 1 addition & 1 deletion tests/10apidoc/30room-create.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
content => {
visibility => "public",
# This is just the localpart
room_alias_name => "30room-create",
room_alias_name => "30room-create-".time,
Copy link
Member

Choose a reason for hiding this comment

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

Why was this added?

Copy link
Member Author

Choose a reason for hiding this comment

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

it was causing test fails when run on an existing db if that alias already existed.

},
)->then( sub {
my ( $body ) = @_;
Expand Down
75 changes: 60 additions & 15 deletions tests/31sync/17peeking.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use Future::Utils qw( repeat );
use JSON qw( decode_json );

# Tests MSC2753 style peeking

Expand All @@ -9,17 +10,25 @@
my ( $user, $room_id, $peeking_user ) = @_;

matrix_set_room_history_visibility( $user, $room_id, "world_readable" )->then(sub {
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
do_request_json_for( $peeking_user,
method => "POST",
uri => "/r0/peek/$room_id",
content => {},
)
})->then( sub {
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
matrix_sync( $peeking_user );
await_sync( $peeking_user,
since => $peeking_user->sync_next_batch,
check => sub {
my ( $body ) = @_;
return 0 unless $body->{rooms}{peek}{$room_id};
return $body;
}
)
})->then( sub {
my ( $body ) = @_;
$peeking_user->sync_next_batch = $body->{next_batch};

log_if_fail "first sync response", $body;

Expand All @@ -46,9 +55,17 @@
})->then( sub {
matrix_send_room_text_message_synced( $user, $room_id, body => "something else to peek");
})->then( sub {
matrix_sync_again( $peeking_user );
await_sync( $peeking_user,
since => $peeking_user->sync_next_batch,
check => sub {
my ( $body ) = @_;
return 0 unless $body->{rooms}{peek}{$room_id};
return $body;
}
)
})->then( sub {
my ( $body ) = @_;
$peeking_user->sync_next_batch = $body->{next_batch};

log_if_fail "third sync response", $body;
my $room = $body->{rooms}{peek}{$room_id};
Expand Down Expand Up @@ -97,17 +114,25 @@
my ( $user, $room_id, $peeking_user ) = @_;

matrix_set_room_history_visibility( $user, $room_id, "world_readable" )->then(sub {
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
do_request_json_for( $peeking_user,
method => "POST",
uri => "/r0/peek/#$room_alias_name:".$user->http->server_name,
content => {},
)
})->then(sub {
matrix_sync( $peeking_user );
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
await_sync( $peeking_user,
since => $peeking_user->sync_next_batch,
check => sub {
my ( $body ) = @_;
return 0 unless $body->{rooms}{peek}{$room_id};
return $body;
}
)
})->then( sub {
my ( $body ) = @_;
$peeking_user->sync_next_batch = $body->{next_batch};

log_if_fail "first sync response", $body;

Expand All @@ -128,36 +153,54 @@
matrix_login_again_with_user($peeking_user);
})->then(sub {
$peeking_user_device2 = $_[0];
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
do_request_json_for( $peeking_user,
method => "POST",
uri => "/r0/peek/$room_id",
content => {},
)
})->then(sub {
matrix_sync( $peeking_user );
matrix_send_room_text_message_synced( $user, $room_id, body => "something to peek");
})->then(sub {
await_sync( $peeking_user,
since => $peeking_user->sync_next_batch,
check => sub {
my ( $body ) = @_;
return 0 unless $body->{rooms}{peek}{$room_id};
return $body;
}
)
})->then( sub {
my ( $body ) = @_;
$peeking_user->sync_next_batch = $body->{next_batch};
log_if_fail "device 1 first sync response", $body;
my $room = $body->{rooms}{peek}{$room_id};
assert_ok( $room->{timeline}->{events}->[-1]->{content}->{body} eq 'something to peek', "peek has message body" );
})->then(sub {
matrix_sync( $peeking_user_device2 );
# FIXME: racey - this may return blank due to the peek not having taken effect yet
matrix_sync( $peeking_user_device2, timeout => 1000 );
})->then( sub {
my ( $body ) = @_;
log_if_fail "device 2 first sync response", $body;
assert_ok( scalar keys(%{$body->{rooms}{peek}}) == 0, "no peeked rooms present");
})->then( sub {
matrix_send_room_text_message_synced( $user, $room_id, body => "something else to peek")
})->then( sub {
matrix_sync_again( $peeking_user );
await_sync( $peeking_user,
since => $peeking_user->sync_next_batch,
check => sub {
my ( $body ) = @_;
return 0 unless $body->{rooms}{peek}{$room_id};
return $body;
}
)
})->then( sub {
my ( $body ) = @_;
$peeking_user->sync_next_batch = $body->{next_batch};
log_if_fail "device 1 second sync response", $body;
my $room = $body->{rooms}{peek}{$room_id};
assert_ok( $room->{timeline}->{events}->[-1]->{content}->{body} eq 'something else to peek', "second peek has message body" );
matrix_sync_again( $peeking_user_device2 );
# FIXME: racey - this may return blank due to the peek not having taken effect yet
matrix_sync_again( $peeking_user_device2, timeout => 1000 );
})->then( sub {
my ( $body ) = @_;
log_if_fail "device 2 second sync response", $body;
Expand All @@ -168,8 +211,10 @@

# test "Users can unpeek from rooms"

# test "Peeking with full_state=true does the right thing"

# test "Joining a peeked room moves it atomically from peeked to joined rooms and stops peeking"

# test "Parting a room which was joined after being peeked"
# test "Parting a room which was joined after being peeked doesn't go back to being peeked"

# test "Changing history visibility to non-world_readable terminates peeks"
# test "Changing history visibility to non-world_readable terminates peeks"