Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create completely new TVars in LoggingSpec #2573

Merged
merged 2 commits into from
Mar 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import Servant
import Servant.Server
( Handler )
import Test.Hspec
( Spec, after, afterAll, beforeAll, describe, it, shouldBe, shouldContain )
( Spec, after, before, describe, it, shouldBe, shouldContain )
import Test.QuickCheck
( Arbitrary (..), choose, counterexample, property, withMaxSuccess )
import Test.QuickCheck.Monadic
Expand All @@ -112,7 +112,7 @@ import qualified Network.Wai.Handler.Warp as Warp

spec :: Spec
spec = describe "Logging Middleware"
$ beforeAll setup $ after clearLogs $ afterAll tearDown $ do
$ before setup $ after tearDown $ do
it "GET, 200, no query" $ \ctx -> do
get ctx "/get"
expectLogs ctx
Expand Down Expand Up @@ -297,9 +297,6 @@ skipPrevLogs = dropWhile (notLogRequestStart . logMsg)
waitForServerToComplete :: IO ()
waitForServerToComplete = threadDelay 500_000

clearLogs :: Context -> IO ()
clearLogs = atomically . flip writeTVar [] . logs

{-------------------------------------------------------------------------------
Test Helpers
-------------------------------------------------------------------------------}
Expand Down