mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
Merge pull request #143 from typesafehub/wip/havocp-invalidate-tests
Add tests for cache invalidation with ref config and full config
This commit is contained in:
commit
d5924b6d01
@ -937,6 +937,28 @@ class PublicApiTest extends TestUtils {
|
|||||||
assertTrue("stuff gets cached repeatedly conf", conf3 eq conf4)
|
assertTrue("stuff gets cached repeatedly conf", conf3 eq conf4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
def invalidateReferenceConfig(): Unit = {
|
||||||
|
val orig = ConfigFactory.defaultReference()
|
||||||
|
val cached = ConfigFactory.defaultReference()
|
||||||
|
assertTrue("reference config was cached", orig eq cached)
|
||||||
|
|
||||||
|
ConfigFactory.invalidateCaches()
|
||||||
|
val changed = ConfigFactory.defaultReference()
|
||||||
|
assertTrue("reference config was invalidated", orig ne changed)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
def invalidateFullConfig(): Unit = {
|
||||||
|
val orig = ConfigFactory.load()
|
||||||
|
val cached = ConfigFactory.load()
|
||||||
|
assertTrue("full config was cached", orig eq cached)
|
||||||
|
|
||||||
|
ConfigFactory.invalidateCaches()
|
||||||
|
val changed = ConfigFactory.load()
|
||||||
|
assertTrue("full config was invalidated", orig ne changed)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
def canUseSomeValuesWithoutResolving(): Unit = {
|
def canUseSomeValuesWithoutResolving(): Unit = {
|
||||||
val conf = ConfigFactory.parseString("a=42,b=${NOPE}")
|
val conf = ConfigFactory.parseString("a=42,b=${NOPE}")
|
||||||
|
Loading…
Reference in New Issue
Block a user