use of com.github.ambry.config.HelixAccountServiceConfig in project ambry by linkedin.
the class BackupFileManagerTest method testDisableBackupDir.
/**
* Test disable backup. Every method from {@link BackupFileManager} should return null or have no effect.
* @throws IOException if I/O error occurs
*/
@Test
public void testDisableBackupDir() throws IOException {
helixConfigProps.remove(HelixAccountServiceConfig.BACKUP_DIRECTORY_KEY);
VerifiableProperties vHelixConfigProps = new VerifiableProperties(helixConfigProps);
HelixAccountServiceConfig config = new HelixAccountServiceConfig(vHelixConfigProps);
BackupFileManager backup = new BackupFileManager(accountServiceMetrics, config.backupDir, config.maxBackupFileCount);
// getLatestAccounts should return null
assertNull("Disabled backup shouldn't have any state", backup.getLatestAccounts(0));
// persistAccountMap should not create any backup
Stat stat = new Stat();
stat.setVersion(1);
stat.setMtime(System.currentTimeMillis());
backup.persistAccountMap(Collections.emptyList(), stat.getVersion(), stat.getMtime() / 1000);
assertTrue("Disabled backup shouldn't add any backup", backup.isEmpty());
}
Aggregations