Fix broken local DB test

Committing transactions DOES help, who could have foreseen this.

Also: expose the PostgreSQL port 5432 to local 15432 via docker-compose
file. Please point me to a cleaner solution, as that port-mapping is clearly not
required except for testing.

Signed-off-by: Maximilian Seifert <max.seifert@drglitch.net>
This commit is contained in:
Maximilian Seifert 2019-08-30 23:18:49 +02:00
parent e58a7c92e9
commit f6ac51bad6
2 changed files with 6 additions and 0 deletions

View file

@ -158,6 +158,8 @@ services:
POSTGRES_USER: dendrite
networks:
- internal
ports:
- "15432:5432"
zookeeper:
container_name: dendrite_zk

View file

@ -73,6 +73,7 @@ func Test_sanityCheckOutputRoomEvents(t *testing.T) {
func TestSyncServerDatasource_selectEventsWithEventIDs(t *testing.T) {
db, err := NewSyncServerDatasource(dataSource)
assert.Nil(t, err)
truncateTable(t, db)
insertTestEvent(t, db)
ctx := context.Background()
txn, err := db.db.Begin()
@ -85,6 +86,9 @@ func TestSyncServerDatasource_selectEventsWithEventIDs(t *testing.T) {
assert.Condition(t, func() bool {
return len(events) > 0
})
err = txn.Commit()
assert.Nil(t, err)
}
func insertTestEvent(t *testing.T, db *SyncServerDatasource) {