@Test
void shouldWorkWhenRegistryIsReloadedAndVaultIsDown() {

  String PASSWORD_PROPERTY_NAME = "password";
  String PASSWORD_PROPERTY_VALUE = "123456";
  String secret = PASSWORD_PROPERTY_NAME + "=" + PASSWORD_PROPERTY_VALUE;
  VaultInstance vaultInstance = vaultContainerExtension.startNewVaultInstance();
  vaultInstance.putSecrets(VAULT_SECRETS_PATH1, secret);
  String address = vaultInstance.address();
  String rootToken = vaultInstance.rootToken();
  ConfigRegistrySettings settings =
      ConfigRegistrySettings.builder()
          .addLastSource(
              "vault",
              VaultConfigSource.builder()
                  .config(vaultConfig -> vaultConfig.address(address).token(rootToken))
                  .addSecretsPath(VAULT_SECRETS_PATH1)
                  .build())
          .jmxEnabled(false)
          .reloadIntervalSec(1)
          .build();
  ConfigRegistry configRegistry = ConfigRegistry.create(settings);
  StringConfigProperty configProperty = configRegistry.stringProperty(PASSWORD_PROPERTY_NAME);
  configProperty.addValidator(Objects::nonNull);
  vaultInstance.close();
  assertFalse(vaultInstance.container().isRunning());
  try {
    TimeUnit.SECONDS.sleep(2);
  } catch (InterruptedException e) {
    fail(e);
  }
  assertThat(configProperty.value().get(), containsString(PASSWORD_PROPERTY_VALUE));
}