Skip to content

Commit ba24644

Browse files
committed
fix test interaction
1 parent c0fa79c commit ba24644

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,16 @@ void testGetHistory() throws Exception {
154154
@Test
155155
void testDetermineParentInvalid() throws Exception {
156156
File codemgrDir = new File(repositoryRoot, SCCSRepository.CODEMGR_WSDATA);
157-
assertTrue(codemgrDir.mkdirs());
157+
if (!codemgrDir.isDirectory()) {
158+
assertTrue(codemgrDir.mkdirs());
159+
}
158160
File parentFile = new File(codemgrDir, "parent");
159161
assertTrue(parentFile.createNewFile());
160162
try (PrintWriter out = new PrintWriter(parentFile.toString())) {
161163
out.println("foo");
162164
}
163165
assertNull(sccsRepository.determineParent(CommandTimeoutType.INDEXER));
166+
assertTrue(parentFile.delete());
164167
}
165168

166169
/**
@@ -169,7 +172,9 @@ void testDetermineParentInvalid() throws Exception {
169172
@Test
170173
void testDetermineParent() throws Exception {
171174
File codemgrDir = new File(repositoryRoot, SCCSRepository.CODEMGR_WSDATA);
172-
assertTrue(codemgrDir.mkdirs());
175+
if (!codemgrDir.isDirectory()) {
176+
assertTrue(codemgrDir.mkdirs());
177+
}
173178
File parentFile = new File(codemgrDir, "parent");
174179
assertTrue(parentFile.createNewFile());
175180
final String expectedParent = "/foo";
@@ -178,6 +183,7 @@ void testDetermineParent() throws Exception {
178183
out.println(expectedParent);
179184
}
180185
assertEquals(expectedParent, sccsRepository.determineParent(CommandTimeoutType.INDEXER));
186+
assertTrue(parentFile.delete());
181187
}
182188

183189
private static class GetHistoryTestParams {

0 commit comments

Comments
 (0)