Skip to content

Commit 24da7b5

Browse files
feat: Add config provider alias priority test (#7706)
1 parent f5b158c commit 24da7b5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,27 @@ class ConfigProviderTest extends DDSpecification {
2222
config["/a"] == "prop"
2323
config["/b"] == "env"
2424
}
25+
26+
27+
def "test config alias priority"() {
28+
setup:
29+
injectEnvConfig("CONFIG_NAME", configNameValue)
30+
injectEnvConfig("CONFIG_ALIAS1", configAlias1Value)
31+
injectEnvConfig("CONFIG_ALIAS2", configAlias2Value)
32+
33+
when:
34+
def config = configProvider.getString("CONFIG_NAME", null, "CONFIG_ALIAS1", "CONFIG_ALIAS2")
35+
36+
then:
37+
config == expected
38+
39+
where:
40+
configNameValue | configAlias1Value | configAlias2Value | expected
41+
"default" | null | null | "default"
42+
null | "alias1" | null | "alias1"
43+
null | null | "alias2" | "alias2"
44+
"default" | "alias1" | null | "default"
45+
"default" | null | "alias2" | "default"
46+
null | "alias1" | "alias2" | "alias1"
47+
}
2548
}

0 commit comments

Comments
 (0)