1--tests which cover multi-process access to the same database directory
3import ProjectM36.Client
12 tcounts <- runTestTT testList
13 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
15assertIOEither :: (Show a) => IO (Either a b) -> IO b
19 Left err -> assertFailure (show err) >> undefined
23testList = TestList [testMultipleProcessAccess]
25testMultipleProcessAccess :: Test
26testMultipleProcessAccess = TestCase $
27 withSystemTempDirectory "pm36" $ \tmpdir -> do
28 let connInfo = InProcessConnectionInfo (MinimalPersistence dbdir) emptyNotificationCallback []
30 dudExpr = Assign "x" (RelationVariable "true" ())
31 dbdir = tmpdir </> "db"
32 conn1 <- assertIOEither $ connectProjectM36 connInfo
33 conn2 <- assertIOEither $ connectProjectM36 connInfo
34 session1 <- assertIOEither (createSessionAtHead conn1 master)
35 session2 <- assertIOEither (createSessionAtHead conn2 master)
36 --add a commit on conn1 which conn2 doesn't know about
37 assertIOEither $ executeDatabaseContextExpr session1 conn1 dudExpr
38 assertIOEither $ commit session1 conn1
40 assertIOEither $ executeDatabaseContextExpr session2 conn2 dudExpr
41 eHeadId <- headTransactionId session2 conn2
42 headId <- case eHeadId of
43 Left err -> assertFailure ("headTransactionId failed: " ++ show err) >> undefined
45 res <- commit session2 conn2
46 assertEqual "commit should fail" (Left (TransactionIsNotAHeadError headId)) res
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list