Skip to content

Commit

Permalink
Merge pull request #109 from k0001/fix-test
Browse files Browse the repository at this point in the history
Add missing imports
  • Loading branch information
jappeace authored Feb 25, 2024
2 parents 411d5d0 + e9cffae commit a159d7a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Data.Pool as Pool
import Test.Tasty.HUnit
import Debug.Trace
-- import Control.Exception.Lifted (finally, catch, bracket)
import Control.Monad (void)
import Control.Monad (void, forM, forM_, replicateM, when)
import Control.Monad.Logger
import Control.Monad.Reader
import Data.Aeson as Aeson
Expand Down Expand Up @@ -387,20 +387,20 @@ testJobDeletion appPool jobPool = testCase "job immediae deletion" $ do
withNamedJobMonitor tname jobPool (\cfg -> cfg { Job.cfgDelayedJobDeletion = Just $ Job.defaultDelayedJobDeletion tname pinterval, Job.cfgDefaultMaxAttempts = 2 }) $ \_logRef -> do
Pool.withResource appPool $ \conn -> do

let assertDeletedJob msg jid =
let assertDeletedJob msg jid =
Job.findJobByIdIO conn tname jid >>= \case
Nothing -> pure ()
Just _ -> assertFailure msg

successJob <- Job.createJob conn tname (PayloadSucceed 0)
failJob <- Job.createJob conn tname (PayloadAlwaysFail 0)
delaySeconds (Job.defaultPollingInterval * 3)

assertDeletedJob "Expecting successful job to be immediately deleted" (jobId successJob)

j <- ensureJobId conn tname (jobId failJob)
assertEqual "Exepcting job to be in Failed status" Job.Failed (jobStatus j)

delaySeconds (Job.defaultPollingInterval * 4)
assertDeletedJob "Expecting failed job to be deleted after adequate delay" (jobId failJob)
where
Expand Down

0 comments on commit a159d7a

Please sign in to comment.