Skip to content

Commit

Permalink
Fix SQLite Synapse runs (#1392)
Browse files Browse the repository at this point in the history
Broke in #1390
  • Loading branch information
erikjohnston authored Dec 20, 2024
1 parent 4ad9b13 commit 14ba2c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
fail-fast: false
matrix:
include:
- label: Py 3.10, SQLite, Monolith
sytest-tag: bookworm-python3.10

- label: Py 3.10, PG 14, Monolith
sytest-tag: bookworm-python3.10
postgres: postgres
Expand Down
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
16 changes: 16 additions & 0 deletions lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ 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';
} elsif ($db_type eq "sqlite" ) {
$db_configs{$db}{name} = 'sqlite3';
} else {
# We should have already validated the database type here.
die "Unrecognized database type: '$db_type'";
}
}

# 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 14ba2c5

Please sign in to comment.