mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
Make DefaultConfigurationCache instance checks more precise
up to now we check some values provided by the DefaultConfigurationCache. This is some kind of plausibility check, but this is not really a check that the instance did not change. With the tests as they are now we check in fact for a new instance.
This commit is contained in:
parent
c93c1079cc
commit
c54b6e6cf2
@ -52,11 +52,16 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testReInitializeOnCustomConfig() {
|
||||
|
||||
DefaultValueCache.createInstance([key:'value'])
|
||||
def instance = DefaultValueCache.createInstance([key:'value'])
|
||||
|
||||
// existing instance is dropped in case a custom config is provided.
|
||||
jsr.step.call(script: nullScript, customDefaults: 'custom.yml')
|
||||
|
||||
// this check is for checking we have another instance
|
||||
assert ! instance.is(DefaultValueCache.getInstance())
|
||||
|
||||
// some additional checks that the configuration represented by the new
|
||||
// config is fine
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 2
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().custom == 'myConfig'
|
||||
@ -65,10 +70,11 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testNoReInitializeWithoutCustomConfig() {
|
||||
|
||||
DefaultValueCache.createInstance([key:'value'])
|
||||
def instance = DefaultValueCache.createInstance([key:'value'])
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
|
||||
assert instance.is(DefaultValueCache.getInstance())
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 1
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().key == 'value'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user