1--tests which cover multi-process access to the same database directory
3import ProjectM36.Client
11 tcounts <- runTestTT testList
12 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
14assertIOEither :: (Show a) => IO (Either a b) -> IO b
18 Left err -> assertFailure (show err) >> undefined
22testList = TestList [testMultipleProcessAccess]
24testMultipleProcessAccess :: Test
25testMultipleProcessAccess = TestCase $
26 withSystemTempDirectory "pm36" $ \tmpdir -> do
27 let connInfo = InProcessConnectionInfo (MinimalPersistence dbdir) emptyNotificationCallback []
29 dudExpr = Assign "x" (RelationVariable "true" ())
30 dbdir = tmpdir </> "db"
31 conn1 <- assertIOEither $ connectProjectM36 connInfo
32 conn2 <- assertIOEither $ connectProjectM36 connInfo
33 session1 <- assertIOEither (createSessionAtHead conn1 master)
34 session2 <- assertIOEither (createSessionAtHead conn2 master)
35 --add a commit on conn1 which conn2 doesn't know about
36 assertIOEither $ executeDatabaseContextExpr session1 conn1 dudExpr
37 assertIOEither $ commit session1 conn1
39 assertIOEither $ executeDatabaseContextExpr session2 conn2 dudExpr
40 eHeadId <- headTransactionId session2 conn2
41 headId <- case eHeadId of
42 Left err -> assertFailure ("headTransactionId failed: " ++ show err) >> undefined
44 res <- commit session2 conn2
45 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