diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 45bbf62cc..e3341baad 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -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 diff --git a/lib/SyTest/Homeserver.pm b/lib/SyTest/Homeserver.pm index bfd0073d5..e6782d260 100644 --- a/lib/SyTest/Homeserver.pm +++ b/lib/SyTest/Homeserver.pm @@ -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'; diff --git a/lib/SyTest/Homeserver/Synapse.pm b/lib/SyTest/Homeserver/Synapse.pm index e50fa3283..7b705588a 100644 --- a/lib/SyTest/Homeserver/Synapse.pm +++ b/lib/SyTest/Homeserver/Synapse.pm @@ -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" ) {