diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml index 266cc53a9..f57323f46 100644 --- a/org.eclipse.jgit.test/pom.xml +++ b/org.eclipse.jgit.test/pom.xml @@ -155,6 +155,10 @@ maven-surefire-plugin -Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory} + + **/*Test.java + **/*Tests.java + diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java index 2da144c87..9236b4e82 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java @@ -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 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 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())));