Skip to content

Commit

Permalink
Fix SQLite Synapse runs
Browse files Browse the repository at this point in the history
Broke in #1390
  • Loading branch information
erikjohnston committed Dec 20, 2024
1 parent 4ad9b13 commit d6769d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/SyTest/Homeserver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,9 @@ sub _get_dbconfigs
foreach my $db ( keys %db_configs ) {
my $db_config = $db_configs{$db};

# Extract the name of the module that is used to access the database. This
# does add a new item to the database config block, 'type'. It appears to
# be harmless and is used later on to determine which method to use to
# clear the database
my $db_name = $db_config->{name};
# Backwards compatibility: the `type` field in the sytest database config
# used to be called `name` and have different values. We fix that up here.
my $db_name = delete $db_config->{name};
if( defined $db_name ) {
if( $db_name eq 'psycopg2' ) {
$db_config->{type} = 'pg';
Expand Down
15 changes: 15 additions & 0 deletions lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ sub start
},
);

# convert sytest db args onto synapse db args
for my $db ( keys %db_configs ) {
my %db_config = %{ $db_configs{$db} };

my $db_type = $db_config{type};

if( $db_type eq "pg" ) {
$db_configs{$db}{name} = 'psycopg2';
}
else {
# must be sqlite
$db_configs{$db}{name} = 'sqlite3';
}
}

# Clean up the media_store directory each time, or else it fills up with
# thousands of automatically-generated avatar images
if( -d "$hs_dir/media_store" ) {
Expand Down

0 comments on commit d6769d7

Please sign in to comment.