diff options
Diffstat (limited to 'kamon-core/src/test/scala/kamon/trace/TracerSpec.scala')
-rw-r--r-- | kamon-core/src/test/scala/kamon/trace/TracerSpec.scala | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/kamon-core/src/test/scala/kamon/trace/TracerSpec.scala b/kamon-core/src/test/scala/kamon/trace/TracerSpec.scala index 3e05adb5..5abfe723 100644 --- a/kamon-core/src/test/scala/kamon/trace/TracerSpec.scala +++ b/kamon-core/src/test/scala/kamon/trace/TracerSpec.scala @@ -42,23 +42,23 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with OptionVal ("boolean" -> TagValue.True)) } - "do not interfere with the currently active Span if not requested when starting a Span" in { - val previouslyActiveSpan = tracer.activeSpan() - tracer.buildSpan("myOperation").start() - tracer.activeSpan() should be theSameInstanceAs(previouslyActiveSpan) - } - - "make a span active with started with the .startActive() function and restore the previous Span when deactivated" in { - val previouslyActiveSpan = tracer.activeSpan() - val activeSpan = tracer.buildSpan("myOperation").startActive() - - tracer.activeSpan() shouldNot be theSameInstanceAs(previouslyActiveSpan) - val activeSpanData = inspect(activeSpan) - activeSpanData.operationName() shouldBe "myOperation" - - activeSpan.deactivate() - tracer.activeSpan() should be theSameInstanceAs(previouslyActiveSpan) - } +// "do not interfere with the currently active Span if not requested when starting a Span" in { +// val previouslyActiveSpan = tracer.activeSpan() +// tracer.buildSpan("myOperation").start() +// tracer.activeSpan() should be theSameInstanceAs(previouslyActiveSpan) +// } +// +// "make a span active with started with the .startActive() function and restore the previous Span when deactivated" in { +// val previouslyActiveSpan = tracer.activeSpan() +// val activeSpan = tracer.buildSpan("myOperation").startActive() +// +// tracer.activeSpan() shouldNot be theSameInstanceAs(previouslyActiveSpan) +// val activeSpanData = inspect(activeSpan) +// activeSpanData.operationName() shouldBe "myOperation" +// +// activeSpan.deactivate() +// tracer.activeSpan() should be theSameInstanceAs(previouslyActiveSpan) +// } "not have any parent Span if there is ActiveSpan and no parent was explicitly given" in { val span = tracer.buildSpan("myOperation").start() @@ -67,9 +67,10 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with OptionVal } "use the currently active span as parent" in { - val parent = tracer.buildSpan("myOperation").startActive() - val child = tracer.buildSpan("childOperation").asChildOf(parent).start() - parent.deactivate() + val parent = tracer.buildSpan("myOperation").start() + val child = Kamon.withActiveSpan(parent) { + tracer.buildSpan("childOperation").asChildOf(parent).start() + } val parentData = inspect(parent) val childData = inspect(child) @@ -77,9 +78,10 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with OptionVal } "ignore the currently active span as parent if explicitly requested" in { - val parent = tracer.buildSpan("myOperation").startActive() - val child = tracer.buildSpan("childOperation").ignoreActiveSpan().start() - parent.deactivate() + val parent = tracer.buildSpan("myOperation").start() + val child = Kamon.withActiveSpan(parent) { + tracer.buildSpan("childOperation").ignoreActiveSpan().start() + } val childData = inspect(child) childData.context().parentID shouldBe IdentityProvider.NoIdentifier |