From 42b0fb3e5ffb56da21cf62e4104af14f5231e110 Mon Sep 17 00:00:00 2001 From: Mustafa Haddara Date: Tue, 14 Jan 2025 16:56:06 -0500 Subject: [PATCH] only use tag for version number in CI --- .../android/HoneycombOptionsInstrumentedTest.kt | 7 ++++++- .../opentelemetry/android/HoneycombOptionsUnitTest.kt | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/androidTest/java/io/honeycomb/opentelemetry/android/HoneycombOptionsInstrumentedTest.kt b/core/src/androidTest/java/io/honeycomb/opentelemetry/android/HoneycombOptionsInstrumentedTest.kt index dc2d9ec..aa80d88 100644 --- a/core/src/androidTest/java/io/honeycomb/opentelemetry/android/HoneycombOptionsInstrumentedTest.kt +++ b/core/src/androidTest/java/io/honeycomb/opentelemetry/android/HoneycombOptionsInstrumentedTest.kt @@ -6,6 +6,7 @@ import androidx.test.platform.app.InstrumentationRegistry import org.junit.Assert.* import org.junit.Test import org.junit.runner.RunWith +import kotlin.math.exp import kotlin.time.Duration.Companion.seconds @RunWith(AndroidJUnit4::class) @@ -23,10 +24,14 @@ class HoneycombOptionsInstrumentedTest { fun runtimeVersion_isAutomaticallySet() { val context = InstrumentationRegistry.getInstrumentation().targetContext val options = HoneycombOptions.builder(context).build() + + var expectedVersion = System.getenv("CIRCLE_TAG") + expectedVersion = expectedVersion?.slice(1 until expectedVersion.length) ?: "0.0.0-DEVELOPMENT" + assertEquals( mapOf( "service.name" to "unknown_service", - "honeycomb.distro.version" to "0.0.0-DEVELOPMENT", + "honeycomb.distro.version" to expectedVersion, "honeycomb.distro.runtime_version" to Build.VERSION.RELEASE, ), options.resourceAttributes, diff --git a/core/src/test/java/io/honeycomb/opentelemetry/android/HoneycombOptionsUnitTest.kt b/core/src/test/java/io/honeycomb/opentelemetry/android/HoneycombOptionsUnitTest.kt index 98a3279..38b7c06 100644 --- a/core/src/test/java/io/honeycomb/opentelemetry/android/HoneycombOptionsUnitTest.kt +++ b/core/src/test/java/io/honeycomb/opentelemetry/android/HoneycombOptionsUnitTest.kt @@ -162,12 +162,15 @@ class HoneycombOptionsUnitTest { ) val options = HoneycombOptions.Builder(HoneycombOptionsMapSource(data)).build() + var expectedVersion = System.getenv("CIRCLE_TAG") + expectedVersion = expectedVersion?.slice(1 until expectedVersion.length) ?: "0.0.0-DEVELOPMENT" + assertEquals("service", options.serviceName) assertEquals( mapOf( "service.name" to "service", "resource" to "aaa", - "honeycomb.distro.version" to "0.0.0-DEVELOPMENT", + "honeycomb.distro.version" to expectedVersion, "honeycomb.distro.runtime_version" to "unknown", ), options.resourceAttributes,