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

Fix SQLite Synapse runs #1392

Merged
merged 3 commits into from
Dec 20, 2024
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
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
Loading