Fix test configuration to run RacyGitTests, and fix testRacyGitDetection
With the filename suffix "Tests", the module was not included in tests when building with Maven, and without the @Test annotations the tests didn't get executed under Eclipse or buck test. testRacyGitDetection was failing because the index file did not exist. Add the missing configuration, the missing annotations, and add a call to reset() in testRacyGitDetection to force creation of the index file. Change-Id: I29dd8f89c36fef4ab40bedce7f4a26bd9b2390e4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
4886621261
commit
5e5fbb6035
|
@ -155,6 +155,10 @@
|
|||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
|
||||
<includes>
|
||||
<include>**/*Test.java</include>
|
||||
<include>**/*Tests.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -51,13 +51,16 @@
|
|||
import java.io.IOException;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.junit.RepositoryTestCase;
|
||||
import org.eclipse.jgit.treewalk.FileTreeIterator;
|
||||
import org.eclipse.jgit.treewalk.FileTreeIteratorWithTimeControl;
|
||||
import org.eclipse.jgit.treewalk.NameConflictTreeWalk;
|
||||
import org.eclipse.jgit.util.FileUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RacyGitTests extends RepositoryTestCase {
|
||||
@Test
|
||||
public void testIterator() throws IllegalStateException, IOException,
|
||||
InterruptedException {
|
||||
TreeSet<Long> modTimes = new TreeSet<>();
|
||||
|
@ -121,11 +124,16 @@ public void testIterator() throws IllegalStateException, IOException,
|
|||
}
|
||||
}
|
||||
|
||||
public void testRacyGitDetection() throws IOException,
|
||||
IllegalStateException, InterruptedException {
|
||||
@Test
|
||||
public void testRacyGitDetection() throws Exception {
|
||||
TreeSet<Long> modTimes = new TreeSet<>();
|
||||
File lastFile;
|
||||
|
||||
// Reset to force creation of index file
|
||||
try (Git git = new Git(db)) {
|
||||
git.reset().call();
|
||||
}
|
||||
|
||||
// wait to ensure that modtimes of the file doesn't match last index
|
||||
// file modtime
|
||||
modTimes.add(valueOf(fsTick(db.getIndexFile())));
|
||||
|
|
Loading…
Reference in New Issue