From 6b1baaae85f8f03f0d52a5100c9e5ccdd5db2818 Mon Sep 17 00:00:00 2001 From: evanlauer1 Date: Tue, 21 May 2024 15:57:45 -0700 Subject: [PATCH] WIP testing for http-client --- instrumentation/http-client/test/Spec.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/instrumentation/http-client/test/Spec.hs b/instrumentation/http-client/test/Spec.hs index 02b7d6e3..73823850 100644 --- a/instrumentation/http-client/test/Spec.hs +++ b/instrumentation/http-client/test/Spec.hs @@ -1,3 +1,19 @@ +import Network.HTTP.Client (Request (requestHeaders), defaultRequest) +import qualified OpenTelemetry.Context as Context +import OpenTelemetry.Instrumentation.HttpClient.Raw (httpTracerProvider, instrumentRequest) +import OpenTelemetry.Propagator +import OpenTelemetry.Trace.Core (getTracerProviderPropagators, getTracerTracerProvider) +import Test.Hspec + main :: IO () -main = putStrLn "Test suite not yet implemented" +main = hspec $ do + describe "OpenTelemetry.Instrumentation.HttpClient" $ do + describe "Raw" $ do + describe "instrumentRequest" $ do + specify "Request has the correct attributes" $ do + request <- instrumentRequest mempty Context.empty defaultRequest + tracer <- httpTracerProvider + context <- extract (getTracerProviderPropagators $ getTracerTracerProvider $ tracer) (requestHeaders request) Context.empty + let maybeAttributes = Context.lookupSpan context + pending \ No newline at end of file