diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2019-04-01 13:26:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 13:26:18 +0200 |
commit | 45237e2977d38053ddedc35765a901cf8771c106 (patch) | |
tree | 4c8ce6da2630dc92dc9f2b4d440b206177a4ab89 /kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala | |
parent | 8efb3b408a876a3dfdac79580773279125cb4135 (diff) | |
parent | 2392fb02c3259d7f0b41ff410641accd818bc5d4 (diff) | |
download | Kamon-45237e2977d38053ddedc35765a901cf8771c106.tar.gz Kamon-45237e2977d38053ddedc35765a901cf8771c106.tar.bz2 Kamon-45237e2977d38053ddedc35765a901cf8771c106.zip |
Introduce a common abstractions to handle tags
Diffstat (limited to 'kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala')
-rw-r--r-- | kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala b/kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala index 5681d300..4fa7116d 100644 --- a/kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala +++ b/kamon-core-tests/src/test/scala/kamon/context/BinaryPropagationSpec.scala @@ -6,6 +6,8 @@ import com.typesafe.config.ConfigFactory import kamon.Kamon import kamon.context.BinaryPropagation.{ByteStreamReader, ByteStreamWriter} import kamon.context.Propagation.{EntryReader, EntryWriter} +import kamon.tag.TagSet +import kamon.tag.Lookups._ import org.scalatest.{Matchers, OptionValues, WordSpec} import scala.util.Random @@ -70,13 +72,14 @@ class BinaryPropagationSpec extends WordSpec with Matchers with OptionValues { } "round trip a Context that only has tags" in { - val context = Context.of(Map("hello" -> "world", "kamon" -> "rulez")) + val context = Context.of(TagSet.from(Map("hello" -> "world", "kamon" -> "rulez"))) val writer = inspectableByteStreamWriter() binaryPropagation.write(context, writer) val rtContext = binaryPropagation.read(ByteStreamReader.of(writer.toByteArray)) rtContext.entries shouldBe empty - rtContext.tags should contain theSameElementsAs (context.tags) + rtContext.tags.get(plain("hello")) shouldBe "world" + rtContext.tags.get(plain("kamon")) shouldBe "rulez" } "round trip a Context that only has entries" in { @@ -91,7 +94,7 @@ class BinaryPropagationSpec extends WordSpec with Matchers with OptionValues { } "round trip a Context that with tags and entries" in { - val context = Context.of(Map("hello" -> "world", "kamon" -> "rulez")) + val context = Context.of(TagSet.from(Map("hello" -> "world", "kamon" -> "rulez"))) .withKey(BinaryPropagationSpec.StringKey, "string-value") .withKey(BinaryPropagationSpec.IntegerKey, 42) @@ -99,7 +102,8 @@ class BinaryPropagationSpec extends WordSpec with Matchers with OptionValues { binaryPropagation.write(context, writer) val rtContext = binaryPropagation.read(ByteStreamReader.of(writer.toByteArray)) - rtContext.tags should contain theSameElementsAs (context.tags) + rtContext.tags.get(plain("hello")) shouldBe "world" + rtContext.tags.get(plain("kamon")) shouldBe "rulez" rtContext.get(BinaryPropagationSpec.StringKey) shouldBe "string-value" rtContext.get(BinaryPropagationSpec.IntegerKey) shouldBe 0 // there is no entry configuration for the integer key } |