Skip to content

Commit

Permalink
http-headers test
Browse files Browse the repository at this point in the history
  • Loading branch information
valerauko committed Nov 21, 2023
1 parent 00c3ced commit 59cf121
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/sleepy/dog_test.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
(ns sleepy.dog-test
(:require [clojure.test :refer [deftest is testing]]
[sleepy.dog :refer [defn-traced
;; http-headers
;; set-resource!
with-tracing
;; wrap-ring-trace
]]))
[sleepy.dog :as datadog :refer [defn-traced
http-headers
with-tracing
;; wrap-ring-trace
]]))

(deftest defn-traced-test
(testing "macro expansion"
Expand Down Expand Up @@ -47,3 +46,12 @@
(is (thrown? RuntimeException (with-tracing "async-throw-test"
@(future
(throw (RuntimeException. "foo"))))))))

(deftest http-headers-test
(let [headers (http-headers)]
(testing "trace-id inclusion"
(let [trace (some-> (datadog/active-span!) (.context) (.toTraceId) (not-empty))]
(is (= trace (get "x-datadog-trace-id" headers)))))
(testing "parent-id inclusion"
(let [trace (some-> (datadog/active-span!) (.context) (.toSpanId) (not-empty))]
(is (= trace (get "x-datadog-parent-id" headers)))))))

0 comments on commit 59cf121

Please sign in to comment.