Skip to content

Commit c17acdc

Browse files
committed
after test
1 parent 95693cc commit c17acdc

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/Simplex/Messaging/Agent/Store/Postgres.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Simplex.Messaging.Agent.Store.Postgres
1212
createDBAndUserIfNotExists,
1313
dropSchema,
1414
dropAllSchemasExceptSystem,
15-
dropDatabaseAndUserIfExists,
15+
dropDatabaseAndUser,
1616
)
1717
where
1818

@@ -152,8 +152,8 @@ dropAllSchemasExceptSystem connectInfo =
152152
forM_ schemaNames $ \(Only schema) ->
153153
PSQL.execute_ db (fromString $ "DROP SCHEMA " <> schema <> " CASCADE")
154154

155-
dropDatabaseAndUserIfExists :: ConnectInfo -> IO ()
156-
dropDatabaseAndUserIfExists ConnectInfo {connectUser = user, connectDatabase = dbName} =
155+
dropDatabaseAndUser :: ConnectInfo -> IO ()
156+
dropDatabaseAndUser ConnectInfo {connectUser = user, connectDatabase = dbName} =
157157
bracket (PSQL.connect defaultConnectInfo {connectUser = "postgres", connectDatabase = "postgres"}) PSQL.close $
158158
\postgresDB -> do
159159
dbExists <- checkDBExists postgresDB dbName

tests/AgentTests.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ import AgentTests.SQLiteTests (storeTests)
2525

2626
agentTests :: ATransport -> Spec
2727
agentTests (ATransport t) = do
28+
describe "Migration tests" migrationTests
2829
describe "Connection request" connectionRequestTests
2930
describe "Double ratchet tests" doubleRatchetTests
3031
#if defined(dbPostgres)
31-
after_ (dropAllSchemasExceptSystem testDBConnectInfo) $
32-
fdescribe "Functional API" $ functionalAPITests (ATransport t)
32+
after_ (dropAllSchemasExceptSystem testDBConnectInfo) $ do
33+
describe "Functional API" $ functionalAPITests (ATransport t)
34+
describe "Chosen servers" serverChoiceTests
3335
#else
3436
describe "Functional API" $ functionalAPITests (ATransport t)
37+
describe "Chosen servers" serverChoiceTests
38+
-- notifications aren't tested with postgres, as we don't plan to use iOS client with it
3539
describe "Notification tests" $ notificationTests (ATransport t)
40+
-- TODO [postgres] add work items tests for postgres (to test 'failed' fields)
3641
describe "SQLite store" storeTests
3742
#endif
38-
describe "Chosen servers" serverChoiceTests
39-
describe "Migration tests" migrationTests

tests/Test.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import XFTPCLI
3636
import XFTPServerTests (xftpServerTests)
3737
#if defined(dbPostgres)
3838
import Fixtures
39-
import Simplex.Messaging.Agent.Store.Postgres (createDBAndUserIfNotExists, dropDatabaseAndUserIfExists)
39+
import Simplex.Messaging.Agent.Store.Postgres (createDBAndUserIfNotExists, dropDatabaseAndUser)
4040
#else
4141
import AgentTests.SchemaDump (schemaDumpTest)
4242
#endif
@@ -52,8 +52,8 @@ main = do
5252
setEnv "APNS_KEY_FILE" "./tests/fixtures/AuthKey_H82WD9K9AQ.p8"
5353
hspec
5454
#if defined(dbPostgres)
55-
. beforeAll_ (dropDatabaseAndUserIfExists testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
56-
. afterAll_ (dropDatabaseAndUserIfExists testDBConnectInfo)
55+
. beforeAll_ (dropDatabaseAndUser testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
56+
. afterAll_ (dropDatabaseAndUser testDBConnectInfo)
5757
#endif
5858
. before_ (createDirectoryIfMissing False "tests/tmp")
5959
. after_ (eventuallyRemove "tests/tmp" 3)

0 commit comments

Comments
 (0)