mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-22 15:01:39 +03:00
dcca0c6275
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5905 GitOrigin-RevId: 48a981a432b2e979bc7b42b32f9c7f53ab9e2598
30 lines
900 B
Haskell
30 lines
900 B
Haskell
module Hasura.Tracing.TraceIdSpec (spec) where
|
|
|
|
import Hasura.Prelude
|
|
import Hasura.Tracing.TraceId
|
|
( randomSpanId,
|
|
randomTraceId,
|
|
spanIdFromBytes,
|
|
spanIdToBytes,
|
|
traceIdFromBytes,
|
|
traceIdToBytes,
|
|
)
|
|
import Test.Hspec
|
|
|
|
spec :: Spec
|
|
spec = do
|
|
describe "TraceId" $ do
|
|
it "roundtrips to and from ByteString" $ do
|
|
let randomRoundTrip :: IO Bool
|
|
randomRoundTrip =
|
|
randomTraceId <&> \traceId ->
|
|
traceIdFromBytes (traceIdToBytes traceId) == Just traceId
|
|
fmap and (replicateM 100 randomRoundTrip) `shouldReturn` True
|
|
describe "SpanId" $ do
|
|
it "roundtrips to and from ByteString" $ do
|
|
let randomRoundTrip :: IO Bool
|
|
randomRoundTrip =
|
|
randomSpanId <&> \spanId ->
|
|
spanIdFromBytes (spanIdToBytes spanId) == Just spanId
|
|
fmap and (replicateM 100 randomRoundTrip) `shouldReturn` True
|