Skip to content

Commit dba270a

Browse files
committed
add test for getHistory() vs history cache per repository
1 parent 53c510a commit dba270a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/history/HistoryGuruTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,23 @@ void testGetLastHistoryEntryRepoHistoryDisabled() throws Exception {
505505
Files.move(tmpHistPath, histPath);
506506
}
507507

508+
@Test
509+
void testGetHistoryVsHistoryCacheEnabled() throws Exception {
510+
File file = Path.of(repository.getSourceRoot(), "git", "main.c").toFile();
511+
assertTrue(file.exists());
512+
HistoryGuru instance = HistoryGuru.getInstance();
513+
Repository repository = instance.getRepository(file);
514+
assertNotNull(repository);
515+
516+
assertTrue(repository.isHistoryCacheEnabled());
517+
assertNotNull(instance.getHistory(file, false, false, false));
518+
repository.setHistoryCacheEnabled(false);
519+
assertNull(instance.getHistory(file, false, false, false));
520+
521+
// cleanup
522+
repository.setHistoryCacheEnabled(true);
523+
}
524+
508525
/**
509526
* Test that it is not possible to get last history entries for repository
510527
* that does not have the merge changesets enabled.

0 commit comments

Comments
 (0)