Skip to content

Commit 938b399

Browse files
committed
Add unit test
1 parent a920898 commit 938b399

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/src/test/scala/brave/play/ZipkinTraceServiceLikeSpec.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2017-2020 The OpenZipkin Authors
2+
* Copyright 2017-2021 The OpenZipkin Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
55
* in compliance with the License. You may obtain a copy of the License at
@@ -114,6 +114,14 @@ class ZipkinTraceServiceLikeSpec extends FunSuite {
114114
assert(reported.tags.get("tag") === "value")
115115
}
116116

117+
test("when sampling is disabled, toSpan results in a new unsampled trace") {
118+
val tracer = new TestZipkinTraceService()
119+
120+
val parent = tracer.toSpan(Map("X-B3-Sampled" -> "0"))(getValueFromMap)
121+
122+
assert(parent.context().parentId() == null)
123+
assert(parent.context().sampled() == false)
124+
}
117125
}
118126

119127
class TestZipkinTraceService extends ZipkinTraceServiceLike {

0 commit comments

Comments
 (0)