Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
simao committed Feb 26, 2021
1 parent a920898 commit 938b399
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/src/test/scala/brave/play/ZipkinTraceServiceLikeSpec.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017-2020 The OpenZipkin Authors
* Copyright 2017-2021 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -114,6 +114,14 @@ class ZipkinTraceServiceLikeSpec extends FunSuite {
assert(reported.tags.get("tag") === "value")
}

test("when sampling is disabled, toSpan results in a new unsampled trace") {
val tracer = new TestZipkinTraceService()

val parent = tracer.toSpan(Map("X-B3-Sampled" -> "0"))(getValueFromMap)

assert(parent.context().parentId() == null)
assert(parent.context().sampled() == false)
}
}

class TestZipkinTraceService extends ZipkinTraceServiceLike {
Expand Down

0 comments on commit 938b399

Please sign in to comment.