From d64bbb1fdb634cafe13c0a19886550332d08f683 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Sat, 10 Feb 2018 01:12:36 +0100 Subject: add support for environment tags, fixes #510 --- .../src/test/scala/kamon/EnvironmentSpec.scala | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'kamon-core-tests') diff --git a/kamon-core-tests/src/test/scala/kamon/EnvironmentSpec.scala b/kamon-core-tests/src/test/scala/kamon/EnvironmentSpec.scala index 82eed862..dadab5af 100644 --- a/kamon-core-tests/src/test/scala/kamon/EnvironmentSpec.scala +++ b/kamon-core-tests/src/test/scala/kamon/EnvironmentSpec.scala @@ -27,7 +27,7 @@ class EnvironmentSpec extends WordSpec with Matchers { | instance = auto |} """.stripMargin - ) + ).withFallback(ConfigFactory.defaultReference()) "the Kamon environment" should { "assign a host and instance name when they are set to 'auto'" in { @@ -36,6 +36,7 @@ class EnvironmentSpec extends WordSpec with Matchers { env.host shouldNot be("auto") env.instance shouldNot be("auto") env.instance shouldBe s"environment-spec@${env.host}" + env.tags shouldBe empty } "use the configured host and instance, if provided" in { @@ -51,6 +52,24 @@ class EnvironmentSpec extends WordSpec with Matchers { env.host should be("spec-host") env.instance should be("spec-instance") + env.tags shouldBe empty + } + + "read all environment tags, if provided" in { + val customConfig = ConfigFactory.parseString( + """ + |kamon.environment.tags { + | custom1 = "test1" + | env = staging + |} + """.stripMargin) + + val env = Environment.fromConfig(customConfig.withFallback(baseConfig)) + + env.tags should contain allOf( + ("custom1" -> "test1"), + ("env" -> "staging") + ) } "always return the same incarnation name" in { -- cgit v1.2.3