Skip to content

Commit

Permalink
Use /v3 endpoints (#1200)
Browse files Browse the repository at this point in the history
* `/v3` endpoints for everybody!

* Try to update Synapse haproxy config (may need attention)

* De-`/v3` CAS-specific URLs
  • Loading branch information
neilalexander authored Mar 2, 2022
1 parent d26da56 commit 5f4c26a
Show file tree
Hide file tree
Showing 106 changed files with 514 additions and 512 deletions.
100 changes: 50 additions & 50 deletions lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1284,10 +1284,10 @@ sub generate_haproxy_map
# haproxy. Also, the routing for GET requests below takes precedence over
# these routes.
my $haproxy_map = <<'EOCONFIG';
^/_matrix/client/(v2_alpha|r0)/sync$ synchrotron
^/_matrix/client/(v2_alpha|r0|v3)/sync$ synchrotron
^/_matrix/client/(api/v1|v2_alpha|r0)/events$ synchrotron
^/_matrix/client/(api/v1|r0)/initialSync$ synchrotron
^/_matrix/client/(api/v1|r0)/rooms/[^/]+/initialSync$ synchrotron
^/_matrix/client/(api/v1|r0|v3)/initialSync$ synchrotron
^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$ synchrotron
^/_matrix/media/ media_repository
Expand All @@ -1311,57 +1311,57 @@ sub generate_haproxy_map
^/_matrix/federation/v1/user/devices/ federation_reader
^/_matrix/key/v2/query federation_reader
^/_matrix/client/(api/v1|r0|unstable)/publicRooms$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/joined_members$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/context/.*$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/members$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/login$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/account/3pid$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/login$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/account/3pid$ client_reader
^/_matrix/client/versions$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$ client_reader
^/_matrix/client/(r0|unstable)/register$ client_reader
^/_matrix/client/(r0|unstable)/auth/.*/fallback/web$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/messages$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/get_groups_publicised$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/joined_groups$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/publicised_groups$ client_reader
^/_matrix/client/(api/v1|r0|unstable)/publicised_groups/ client_reader
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/event client_reader
^/_matrix/client/(api/v1|r0|unstable)/joined_rooms client_reader
^/_matrix/client/(api/v1|r0|unstable/.*)/rooms/.*/aliases client_reader
^/_matrix/client/(api/v1|r0|unstable)/search client_reader
^/_matrix/client/(api/v1|r0|unstable)/devices$ stream_writer
^/_matrix/client/(api/v1|r0|unstable)/keys/query$ stream_writer
^/_matrix/client/(api/v1|r0|unstable)/keys/changes$ stream_writer
^/_matrix/client/(api/v1|r0|unstable)/keys/claim stream_writer
^/_matrix/client/(api/v1|r0|unstable)/room_keys stream_writer
^/_matrix/client/(api/v1|r0|unstable)/presence/ stream_writer
^/_matrix/client/(api/v1|r0|unstable)/keys/upload frontend_proxy
^/_matrix/client/(r0|unstable|v2_alpha)/user_directory/ user_dir
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/redact event_creator
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send event_creator
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$ event_creator
^/_matrix/client/(api/v1|r0|unstable)/join/ event_creator
^/_matrix/client/(api/v1|r0|unstable)/profile/ event_creator
^/_matrix/client/(api/v1|r0|unstable)/createRoom event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$ client_reader
^/_matrix/client/(r0|v3|unstable)/register$ client_reader
^/_matrix/client/(r0|v3|unstable)/auth/.*/fallback/web$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/messages$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/get_groups_publicised$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_groups$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/publicised_groups$ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/publicised_groups/ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms client_reader
^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/search client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/devices$ stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/query$ stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/changes$ stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/claim stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/room_keys stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/upload frontend_proxy
^/_matrix/client/(r0|v3|unstable|v2_alpha)/user_directory/ user_dir
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$ event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/join/ event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/profile/ event_creator
^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom event_creator
EOCONFIG

# Some things can only be moved off master when using redis.
if ( $self->{redis_host} ne '' ) {
$haproxy_map .= <<'EOCONFIG';
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing stream_writer
^/_matrix/client/(api/v1|r0|unstable)/sendToDevice/ stream_writer
^/_matrix/client/(api/v1|r0|unstable)/.*/tags stream_writer
^/_matrix/client/(api/v1|r0|unstable)/.*/account_data stream_writer
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/receipt stream_writer
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/read_markers stream_writer
^/_matrix/client/(api/v1|r0|v3|v3|unstable)/rooms/.*/typing stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/sendToDevice/ stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/.*/tags stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/.*/account_data stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/receipt stream_writer
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/read_markers stream_writer
EOCONFIG
}
Expand All @@ -1373,10 +1373,10 @@ sub generate_haproxy_get_map
{
return <<'EOCONFIG';
# pushrules should be here, but the tests seem to be racy.
# ^/_matrix/client/(api/v1|r0|unstable)/pushrules/ client_reader
^/_matrix/client/(api/v1|r0|unstable)/groups/ client_reader
^/_matrix/client/r0/user/[^/]*/account_data/ client_reader
^/_matrix/client/r0/user/[^/]*/rooms/[^/]*/account_data/ client_reader
# ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ client_reader
^/_matrix/client/(api/v1|r0|v3|unstable)/groups/ client_reader
^/_matrix/client/(r0|v3)/user/[^/]*/account_data/ client_reader
^/_matrix/client/(r0|v3)/user/[^/]*/rooms/[^/]*/account_data/ client_reader
^/_matrix/federation/v1/groups/ federation_reader
EOCONFIG
Expand Down
26 changes: 13 additions & 13 deletions tests/10apidoc/01register.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {},
)->main::expect_http_401
Expand All @@ -23,11 +23,11 @@
# Despite being an HTTP failure, the body is still JSON encoded and
# has useful information
assert_eq( $response->content_type, "application/json",
'POST /r0/register results in application/json 401 failure'
'POST /v3/register results in application/json 401 failure'
);

my $body = decode_json( $response->content );
log_if_fail "/r0/register flow information", $body;
log_if_fail "/v3/register flow information", $body;

assert_json_keys( $body, qw( flows ));
ref $body->{flows} eq "ARRAY" or die "Expected 'flows' as a list";
Expand Down Expand Up @@ -60,7 +60,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {
auth => {
Expand All @@ -87,7 +87,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {
auth => {
Expand Down Expand Up @@ -117,7 +117,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {
auth => {
Expand Down Expand Up @@ -159,15 +159,15 @@
# registration without the dodgy char should be ok
$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => $reqbody,
)->then( sub {
# registration with the dodgy char should 400
$reqbody->{username} .= $chr;
$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",
content => $reqbody,
);
})->main::expect_http_400()
Expand Down Expand Up @@ -204,7 +204,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => $reqbody,
);
Expand Down Expand Up @@ -242,7 +242,7 @@ sub matrix_register_user

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {
auth => {
Expand Down Expand Up @@ -510,7 +510,7 @@ sub setup_user
my $user = $f->get;
do_request_json_for( $user,
method => "PUT",
uri => "/r0/profile/:user_id/displayname",
uri => "/v3/profile/:user_id/displayname",

content => { displayname => $displayname },
)->then_done( $user );
Expand All @@ -521,7 +521,7 @@ sub setup_user
my $user = $f->get;
do_request_json_for( $user,
method => "PUT",
uri => "/r0/profile/:user_id/avatar_url",
uri => "/v3/profile/:user_id/avatar_url",

content => { avatar_url => $avatar_url },
)->then_done( $user );
Expand All @@ -532,7 +532,7 @@ sub setup_user
my $user = $f->get;
do_request_json_for( $user,
method => "PUT",
uri => "/r0/presence/:user_id/status",
uri => "/v3/presence/:user_id/status",

content => {
presence => $presence,
Expand Down
2 changes: 1 addition & 1 deletion tests/10apidoc/01request-encoding.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$http->do_request(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => $reqbody,
content_type =>"application/json",
Expand Down
16 changes: 8 additions & 8 deletions tests/10apidoc/02login.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/register",
uri => "/v3/register",

content => {
auth => {
Expand All @@ -38,7 +38,7 @@

$http->do_request_json(
method => "GET",
uri => "/r0/login",
uri => "/v3/login",
)->then( sub {
my ( $body ) = @_;

Expand Down Expand Up @@ -78,7 +78,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",

content => {
type => "m.login.password",
Expand Down Expand Up @@ -113,7 +113,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",

content => {
type => "m.login.password",
Expand Down Expand Up @@ -148,7 +148,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",

content => {
type => "m.login.password",
Expand Down Expand Up @@ -179,7 +179,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",

content => {
type => "m.login.password",
Expand All @@ -201,7 +201,7 @@

$http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",

content => {
type => "m.login.password",
Expand Down Expand Up @@ -237,7 +237,7 @@ sub matrix_login_again_with_user

$user->http->do_request_json(
method => "POST",
uri => "/r0/login",
uri => "/v3/login",
content => {
type => "m.login.password",
identifier => {
Expand Down
6 changes: 3 additions & 3 deletions tests/10apidoc/03events-initial.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

do_request_json_for( $user,
method => "GET",
uri => "/r0/initialSync",
uri => "/v3/initialSync",
)->then( sub {
my ( $body ) = @_;

Expand All @@ -63,7 +63,7 @@ sub matrix_initialsync

do_request_json_for( $user,
method => "GET",
uri => "/r0/initialSync",
uri => "/v3/initialSync",

params => {
( map { defined $args{$_} ? ( $_ => $args{$_} ) : () }
Expand Down Expand Up @@ -227,7 +227,7 @@ sub matrix_sync

do_request_json_for( $user,
method => "GET",
uri => "/r0/sync",
uri => "/v3/sync",
params => \%params,
)->on_done( sub {
my ( $body ) = @_;
Expand Down
8 changes: 4 additions & 4 deletions tests/10apidoc/10profile-displayname.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

do_request_json_for( $user,
method => "GET",
uri => "/r0/profile/:user_id/displayname",
uri => "/v3/profile/:user_id/displayname",
)->then( sub {
my ( $body ) = @_;

Expand All @@ -30,7 +30,7 @@

do_request_json_for( $user,
method => "PUT",
uri => "/r0/profile/:user_id/displayname",
uri => "/v3/profile/:user_id/displayname",

content => {
displayname => $displayname,
Expand All @@ -50,7 +50,7 @@

$http->do_request_json(
method => "GET",
uri => "/r0/profile/$user_id/displayname",
uri => "/v3/profile/$user_id/displayname",
# no access_token
)->then( sub {
my ( $body ) = @_;
Expand All @@ -74,7 +74,7 @@ sub matrix_set_displayname

do_request_json_for( $user,
method => "PUT",
uri => "/r0/profile/:user_id/displayname",
uri => "/v3/profile/:user_id/displayname",

content => { displayname => $displayname },
);
Expand Down
Loading

0 comments on commit 5f4c26a

Please sign in to comment.