Skip to content

Commit 6d0f52d

Browse files
committed
attempt to fix jacoco
1 parent 81db67d commit 6d0f52d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

internal-api/src/test/groovy/datadog/trace/bootstrap/config/provider/ConfigProviderTest.groovy

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,40 @@ class ConfigProviderTest extends DDSpecification {
139139
"getDouble" | "test.double" | "DD_TEST_DOUBLE"| "42.75" | "notADouble" | 2.71 | 42.75 | { configProvider, key, defVal -> configProvider.getDouble(key, defVal) }
140140
}
141141

142+
def "ConfigProvider does not report final result when conditions are not met"() {
143+
setup:
144+
ConfigCollector.get().collect() // clear previous state
145+
146+
// Set up different combinations that should NOT trigger re-reporting
147+
if (injectEnv) {
148+
injectEnvConfig("DD_TEST_MAP", envValue)
149+
}
150+
if (injectJvm) {
151+
injectSysConfig("test.map", jvmValue)
152+
}
153+
154+
def provider = ConfigProvider.createDefault()
155+
156+
when:
157+
def result = provider.getMergedMap("test.map")
158+
def collected = ConfigCollector.get().collect()
159+
160+
then:
161+
// Should NOT have a CALCULATED entry because conditions to re-report have not been met:
162+
def calculatedSettings = collected.get(ConfigOrigin.CALCULATED)
163+
calculatedSettings == null || !calculatedSettings.containsKey("test.map")
164+
165+
// Verify the result matches expectations
166+
result == [:]
167+
168+
where:
169+
injectEnv | injectJvm | envValue | jvmValue
170+
false | false | null | null
171+
true | false | "" | null
172+
false | true | null | " "
173+
true | true | "" | ""
174+
}
175+
142176
def "ConfigProvider transforms invalid values for getBoolean to false with CALCULATED origin"() {
143177
// Booleans are a special case; we currently treat all invalid boolean configurations as false rather than falling back to a lower precedence setting.
144178
setup:

0 commit comments

Comments
 (0)