Merge pull request #2809 from metamx/fix2694

Fix test for snapshot taker to better check for lookup perist failure
This commit is contained in:
Charles Allen 2016-04-11 14:52:47 -07:00 committed by Fangjin Yang
parent 9440598685
commit 21e406613c
2 changed files with 5 additions and 2 deletions

View File

@ -37,7 +37,7 @@ import java.util.List;
public class LookupSnapshotTaker
{
private static final Logger LOGGER = new Logger(LookupSnapshotTaker.class);
private static final String PERSIST_FILE_NAME = "lookupSnapshot.json";
protected static final String PERSIST_FILE_NAME = "lookupSnapshot.json";
private final ObjectMapper objectMapper;
private final File persistDirectory;

View File

@ -73,7 +73,10 @@ public class LookupSnapshotTakerTest
public void testIOExceptionDuringLookupPersist() throws IOException
{
File directory = temporaryFolder.newFolder();
directory.setReadOnly();
File snapshotFile = new File(directory, LookupSnapshotTaker.PERSIST_FILE_NAME);
Assert.assertFalse(snapshotFile.exists());
Assert.assertTrue(snapshotFile.createNewFile());
Assert.assertTrue(snapshotFile.setReadOnly());
LookupSnapshotTaker lookupSnapshotTaker = new LookupSnapshotTaker(mapper, directory.getAbsolutePath());
LookupBean lookupBean = new LookupBean();
lookupBean.name = "name";