Split host tests by component ownership
This commit is contained in:
parent
68a92662c0
commit
48a5b8a433
1 changed files with 1435 additions and 1309 deletions
27
test/Nuthatch/Test/Product.hs
Normal file
27
test/Nuthatch/Test/Product.hs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module Nuthatch.Test.Product
|
||||
( tests
|
||||
) where
|
||||
|
||||
import Control.Concurrent (threadDelay)
|
||||
import GHC.Clock (getMonotonicTimeNSec)
|
||||
import Nuthatch.Browse (collectKeysBoundedWith)
|
||||
import Nuthatch.S3 (ListPage (..))
|
||||
import Test.Tasty (TestTree, testGroup)
|
||||
import Test.Tasty.HUnit ((@?=), assertBool, testCase)
|
||||
|
||||
tests :: TestTree
|
||||
tests = testGroup "product behavior"
|
||||
[ testCase "search deadline cancels an in-flight listing" $ do
|
||||
started <- getMonotonicTimeNSec
|
||||
result <- collectKeysBoundedWith
|
||||
getMonotonicTimeNSec
|
||||
(\_ _ -> do
|
||||
threadDelay 100000
|
||||
pure (Right (ListPage [] [] Nothing False)))
|
||||
100
|
||||
(started + 5000000)
|
||||
finished <- getMonotonicTimeNSec
|
||||
result @?= Right ([], True)
|
||||
assertBool "listing returns inside the configured deadline margin"
|
||||
(finished - started < 50000000)
|
||||
]
|
||||
Loading…
Reference in a new issue