Skip to content

Commit

Permalink
feat: Add config provider alias priority test (#7706)
Browse files Browse the repository at this point in the history
  • Loading branch information
PerfectSlayer authored Oct 8, 2024
1 parent f5b158c commit 24da7b5
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,27 @@ class ConfigProviderTest extends DDSpecification {
config["/a"] == "prop"
config["/b"] == "env"
}


def "test config alias priority"() {
setup:
injectEnvConfig("CONFIG_NAME", configNameValue)
injectEnvConfig("CONFIG_ALIAS1", configAlias1Value)
injectEnvConfig("CONFIG_ALIAS2", configAlias2Value)

when:
def config = configProvider.getString("CONFIG_NAME", null, "CONFIG_ALIAS1", "CONFIG_ALIAS2")

then:
config == expected

where:
configNameValue | configAlias1Value | configAlias2Value | expected
"default" | null | null | "default"
null | "alias1" | null | "alias1"
null | null | "alias2" | "alias2"
"default" | "alias1" | null | "default"
"default" | null | "alias2" | "default"
null | "alias1" | "alias2" | "alias1"
}
}

0 comments on commit 24da7b5

Please sign in to comment.