mirror of
https://github.com/lightbend/config.git
synced 2025-01-24 19:30:06 +08:00
Add tests for cache invalidation with ref config and full config
This commit is contained in:
parent
49770d9290
commit
a0c22c3687
@ -937,6 +937,28 @@ class PublicApiTest extends TestUtils {
|
||||
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
|
||||
def canUseSomeValuesWithoutResolving(): Unit = {
|
||||
val conf = ConfigFactory.parseString("a=42,b=${NOPE}")
|
||||
|
Loading…
Reference in New Issue
Block a user