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

Allow running Synapse with the asyncioreactor enabled #1301

Merged
merged 1 commit into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The following environment variables can be set with `-e` to control the test run
PostgreSQL databases where the main store and state store are split.
- `WORKERS`: set non-empty to test a worker-mode deployment rather than a
monolith. Requires `POSTGRES`.
- `ASYNCIO_REACTOR`: set non-empty to test with the Twisted asyncio reactor enabled
- `OFFLINE`: set non-empty to avoid updating the python or perl dependencies.
- `BLACKLIST`: set non-empty to change the default blacklist file to the
specified path relative to the Synapse directory
Expand Down
3 changes: 2 additions & 1 deletion lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sub _init
my ( $args ) = @_;

$self->{$_} = delete $args->{$_} for qw(
synapse_dir extra_args python coverage
synapse_dir extra_args python coverage asyncio_reactor
);

$self->{paths} = {};
Expand Down Expand Up @@ -380,6 +380,7 @@ sub start
"PATH" => $ENV{PATH},
"PYTHONDONTWRITEBYTECODE" => "Don't write .pyc files",
"SYNAPSE_TEST_PATCH_LOG_CONTEXTS" => 1,
"SYNAPSE_ASYNC_IO_REACTOR" => $self->{asyncio_reactor},
};

my $loop = $self->loop;
Expand Down
14 changes: 9 additions & 5 deletions lib/SyTest/HomeserverFactory/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ sub _init
$self->{impl} = "SyTest::Homeserver::Synapse::Direct";

$self->{args} = {
synapse_dir => "../synapse",
python => "python",
coverage => 0,
print_output => 0,
filter_output => undef,
synapse_dir => "../synapse",
python => "python",
asyncio_reactor => 0,
coverage => 0,
print_output => 0,
filter_output => undef,
};

$self->{extra_args} = [];
Expand All @@ -51,6 +52,7 @@ sub get_options
'd|synapse-directory=s' => \$self->{args}{synapse_dir},
'python=s' => \$self->{args}{python},
'coverage+' => \$self->{args}{coverage},
'asyncio-reactor+' => \$self->{args}{asyncio_reactor},

'S|server-log+' => \$self->{args}{print_output},
'server-grep=s' => \$self->{args}{filter_output},
Expand All @@ -77,6 +79,8 @@ sub print_usage

--coverage - generate code coverage stats for synapse

--asyncio-reactor - run Synapse with the asyncio reactor enabled

-ENAME, -ENAME=VALUE - pass extra argument NAME or NAME=VALUE to the
homeserver.
EOF
Expand Down
4 changes: 4 additions & 0 deletions scripts/synapse_sytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ RUN_TESTS=(
--work-directory="/work"
)

if [ -n "$ASYNCIO_REACTOR" ]; then
RUN_TESTS+=(--asyncio-reactor)
fi

if [ -n "$WORKERS" ]; then
RUN_TESTS+=(-I Synapse::ViaHaproxy --workers)
RUN_TESTS+=(--redis-host=localhost)
Expand Down