diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-08-14 17:30:16 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-08-14 17:30:16 +0200 |
commit | 3a8c0fa25f12230b27e943d1fffe07f814c650fe (patch) | |
tree | 75a12128af7387f40e3eba040812e1bd87b9a455 /kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala | |
parent | a6113cf33ba1b98cc73d35176ccf8a2f76b77875 (diff) | |
download | Kamon-3a8c0fa25f12230b27e943d1fffe07f814c650fe.tar.gz Kamon-3a8c0fa25f12230b27e943d1fffe07f814c650fe.tar.bz2 Kamon-3a8c0fa25f12230b27e943d1fffe07f814c650fe.zip |
implement Span propagation on top of Kamon.Context
Diffstat (limited to 'kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala')
-rw-r--r-- | kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala b/kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala deleted file mode 100644 index a6a7bc3a..00000000 --- a/kamon-core/src/test/scala/kamon/trace/ActiveSpanManagementSpec.scala +++ /dev/null @@ -1,65 +0,0 @@ -package kamon.trace - -import kamon.Kamon -import kamon.testkit.SpanInspector -import kamon.trace.Span.Annotation -import kamon.util.Clock -import org.scalatest.{Matchers, WordSpec} - -class ActiveSpanManagementSpec extends WordSpec with Matchers { - - "Kamon acting as a ActiveSpanSource" should { - "return a empty span when there is no currently active Span" in { - inspect(Kamon.activeSpan()) shouldBe empty - } - - "safely operate on a empty Span" in { - val emptySpan = Kamon.activeSpan() - val activeSpanData = inspect(Kamon.activeSpan()) - activeSpanData shouldBe empty - - emptySpan - .setOperationName("test") - .addBaggage("key", "value") - .addMetricTag("key", "value") - .addSpanTag("string", "string") - .addSpanTag("number", 42) - .addSpanTag("boolean-true", true) - .addSpanTag("boolean-false", false) - .annotate(Annotation(Clock.microTimestamp(), "event", Map("k" -> "v"))) - - val baggage = emptySpan.context().baggage - baggage.add("key", "value") - baggage.get("key") shouldBe empty - baggage.getAll() shouldBe empty - - Kamon.withActiveSpan(emptySpan) { - inspect(Kamon.activeSpan()) shouldBe empty - } - - inspect(Kamon.activeSpan()) shouldBe empty - } - - "set a Span as active when using activate" in { - val span = Kamon.buildSpan("mySpan").start() - val scope = Kamon.activate(span) - Kamon.activeSpan() shouldBe theSameInstanceAs(span) - scope.close() - } - - "restore the previously active Span when a scope is closed" in { - val previouslyActiveSpan = Kamon.activeSpan() - inspect(Kamon.activeSpan()) shouldBe empty - - val span = Kamon.buildSpan("mySpan").start() - Kamon.withActiveSpan(span) { - Kamon.activeSpan() shouldBe theSameInstanceAs(span) - } - - Kamon.activeSpan() shouldBe theSameInstanceAs(previouslyActiveSpan) - } - } - - def inspect(span: Span): SpanInspector = - SpanInspector(span) -} |