Skip to content

Commit 5f0cf15

Browse files
jorisdralwenkokke
authored andcommitted
QLS: test exception safety for the OpenSnapshot action
1 parent f00f3c2 commit 5f0cf15

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/Test/Database/LSMTree/StateMachine.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import qualified System.FS.Sim.Error as FSSim
117117
import System.FS.Sim.Error (Errors)
118118
import qualified System.FS.Sim.MockFS as MockFS
119119
import System.FS.Sim.MockFS (MockFS)
120+
import qualified System.FS.Sim.Stream as Stream
120121
import System.FS.Sim.Stream (Stream)
121122
import System.IO.Temp (createTempDirectory,
122123
getCanonicalTemporaryDirectory)
@@ -1434,8 +1435,13 @@ arbitraryActionWithVars _ label ctx (ModelState st _stats) =
14341435
++ [ (1, fmap Some $ OpenSnapshot @k @v @b PrettyProxy <$>
14351436
genErrors <*> pure label <*> genUsedSnapshotName)
14361437
| not (null usedSnapshotNames)
1437-
-- TODO: generate errors
1438-
, let genErrors = pure Nothing
1438+
, let genErrors = do
1439+
merrs <- QC.arbitrary
1440+
case merrs of
1441+
Nothing -> pure Nothing
1442+
Just errs -> pure . Just $ errs {
1443+
FSSim.removeDirectoryRecursiveE = Stream.empty
1444+
}
14391445
]
14401446

14411447
++ [ (1, fmap Some $ DeleteSnapshot <$> genUsedSnapshotName)

0 commit comments

Comments
 (0)