Skip to content

Commit 77e851e

Browse files
austbrbrw
authored andcommitted
(maint) test: remove usage of deprecated getContext
getContext is deprecated, we were only using it in `utils_test` anyways, so replace it with a number of `get` calls to placate eastwood and ensure we are not broken by future updates.
1 parent b64e130 commit 77e851e

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

test/puppetlabs/puppetdb/utils_test.clj

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,27 @@
2323
(with-log-mdc ["foo" "bar"]
2424
(is (= "bar" (MDC/get "foo"))))
2525
(with-log-mdc ["foo" nil]
26-
(is (= {} (MDC/getContext))))
26+
(is (= nil (MDC/get "foo"))))
2727
(with-log-mdc ["foo" nil "bar" 1]
28-
(is (= {"bar" "1"} (MDC/getContext))))
28+
(is (= nil (MDC/get "foo")))
29+
(is (= "1" (MDC/get "bar"))))
2930
(with-log-mdc ["foo" 1 "bar" nil]
30-
(is (= {"foo" "1"} (MDC/getContext))))
31+
(is (= "1" (MDC/get "foo")))
32+
(is (= nil (MDC/get "bar"))))
3133
(with-log-mdc ["foo" "x" "bar" "y"]
32-
(is (= {"foo" "x" "bar" "y"} (MDC/getContext))))
34+
(is (= "x" (MDC/get "foo")))
35+
(is (= "y" (MDC/get "bar"))))
3336
(with-log-mdc ["foo" "x" "bar" nil "baz" "z"]
34-
(is (= {"foo" "x" "baz" "z"} (MDC/getContext)))
37+
(is (= "x" (MDC/get "foo")))
38+
(is (= nil (MDC/get "bar")))
39+
(is (= "z" (MDC/get "baz")))
3540
(with-log-mdc ["foo" "x" "bar" "y" "baz" "z"]
36-
(is (= {"foo" "x" "bar" "y" "baz" "z"} (MDC/getContext))))
37-
(is (= {"foo" "x" "baz" "z"} (MDC/getContext)))))
41+
(is (= "x" (MDC/get "foo")))
42+
(is (= "y" (MDC/get "bar")))
43+
(is (= "z" (MDC/get "baz"))))
44+
(is (= "x" (MDC/get "foo")))
45+
(is (= nil (MDC/get "bar")))
46+
(is (= "z" (MDC/get "baz")))))
3847

3948
(deftest test-assoc-when
4049
(is (= {:a 1 :b 2}

0 commit comments

Comments
 (0)