File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
src/Simplex/Messaging/Agent/Store Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ module Simplex.Messaging.Agent.Store.Postgres
12
12
createDBAndUserIfNotExists ,
13
13
dropSchema ,
14
14
dropAllSchemasExceptSystem ,
15
- dropDatabaseAndUserIfExists ,
15
+ dropDatabaseAndUser ,
16
16
)
17
17
where
18
18
@@ -152,8 +152,8 @@ dropAllSchemasExceptSystem connectInfo =
152
152
forM_ schemaNames $ \ (Only schema) ->
153
153
PSQL. execute_ db (fromString $ " DROP SCHEMA " <> schema <> " CASCADE" )
154
154
155
- dropDatabaseAndUserIfExists :: ConnectInfo -> IO ()
156
- dropDatabaseAndUserIfExists ConnectInfo {connectUser = user, connectDatabase = dbName} =
155
+ dropDatabaseAndUser :: ConnectInfo -> IO ()
156
+ dropDatabaseAndUser ConnectInfo {connectUser = user, connectDatabase = dbName} =
157
157
bracket (PSQL. connect defaultConnectInfo {connectUser = " postgres" , connectDatabase = " postgres" }) PSQL. close $
158
158
\ postgresDB -> do
159
159
dbExists <- checkDBExists postgresDB dbName
Original file line number Diff line number Diff line change @@ -25,15 +25,18 @@ import AgentTests.SQLiteTests (storeTests)
25
25
26
26
agentTests :: ATransport -> Spec
27
27
agentTests (ATransport t) = do
28
+ describe " Migration tests" migrationTests
28
29
describe " Connection request" connectionRequestTests
29
30
describe " Double ratchet tests" doubleRatchetTests
30
31
#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
33
35
#else
34
36
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
35
39
describe " Notification tests" $ notificationTests (ATransport t)
40
+ -- TODO [postgres] add work items tests for postgres (to test 'failed' fields)
36
41
describe " SQLite store" storeTests
37
42
#endif
38
- describe " Chosen servers" serverChoiceTests
39
- describe " Migration tests" migrationTests
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import XFTPCLI
36
36
import XFTPServerTests (xftpServerTests )
37
37
#if defined(dbPostgres)
38
38
import Fixtures
39
- import Simplex.Messaging.Agent.Store.Postgres (createDBAndUserIfNotExists , dropDatabaseAndUserIfExists )
39
+ import Simplex.Messaging.Agent.Store.Postgres (createDBAndUserIfNotExists , dropDatabaseAndUser )
40
40
#else
41
41
import AgentTests.SchemaDump (schemaDumpTest )
42
42
#endif
@@ -52,8 +52,8 @@ main = do
52
52
setEnv " APNS_KEY_FILE" " ./tests/fixtures/AuthKey_H82WD9K9AQ.p8"
53
53
hspec
54
54
#if defined(dbPostgres)
55
- . beforeAll_ (dropDatabaseAndUserIfExists testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
56
- . afterAll_ (dropDatabaseAndUserIfExists testDBConnectInfo)
55
+ . beforeAll_ (dropDatabaseAndUser testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
56
+ . afterAll_ (dropDatabaseAndUser testDBConnectInfo)
57
57
#endif
58
58
. before_ (createDirectoryIfMissing False " tests/tmp" )
59
59
. after_ (eventuallyRemove " tests/tmp" 3 )
You can’t perform that action at this time.
0 commit comments