Split host tests by component ownership

This commit is contained in:
ms2k 2026-07-20 01:47:55 +09:00
commit 48a5b8a433

View 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)
]