Skip to content

Commit

Permalink
Add support for running worker mode against redis (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Apr 22, 2020
1 parent 5a11814 commit 394ee60
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sub _init

$self->{paths} = {};
$self->{dendron} = '';
$self->{redis_host} = '';

$self->SUPER::_init( $args );

Expand Down Expand Up @@ -282,6 +283,11 @@ sub start
limit_usage_by_mau => "true",
max_mau_value => 50000000,

redis => {
enabled => $self->{redis_host} ne '',
host => $self->{redis_host},
},

map {
defined $self->{$_} ? ( $_ => $self->{$_} ) : ()
} qw(
Expand Down Expand Up @@ -653,6 +659,7 @@ sub _init
$self->SUPER::_init( @_ );

$self->{dendron} = delete $args->{dendron_binary};
$self->{redis_host} = delete $args->{redis_host};

if( my $level = delete $args->{torture_replication} ) {
# torture the replication protocol a bit, to replicate bugs.
Expand Down
6 changes: 5 additions & 1 deletion lib/SyTest/HomeserverFactory/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,17 @@ sub _init
$self->{impl} = "SyTest::Homeserver::Synapse::ViaDendron";
$self->{args}{dendron_binary} = "";
$self->{args}{torture_replication} = 0;
$self->{args}{redis_host} = "";
}

sub get_options
{
my $self = shift;

return (
'dendron-binary=s' => \$self->{args}{dendron_binary},
'dendron-binary=s' => \$self->{args}{dendron_binary},
'torture-replication:50' => \$self->{args}{torture_replication},
'redis-host=s' => \$self->{args}{redis_host},
$self->SUPER::get_options(),
);
}
Expand All @@ -125,6 +127,8 @@ sub print_usage
--dendron-binary PATH - path to the 'dendron' binary
--torture-replication[=LEVEL] - enable torturing of the replication protocol
--redis-host HOST - if set then use redis for replication
EOF
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/synapse_sytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if [ -n "$OFFLINE" ]; then
else
# We've already created the virtualenv, but lets double check we have all
# deps.
/venv/bin/pip install -q --upgrade --no-cache-dir /src
/venv/bin/pip install -q --upgrade --no-cache-dir /src[redis]
/venv/bin/pip install -q --upgrade --no-cache-dir \
lxml psycopg2 coverage codecov tap.py coverage_enable_subprocess

Expand Down

0 comments on commit 394ee60

Please sign in to comment.