summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-03-19 10:23:29 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2017-03-19 10:56:06 +0900
commit5e5fbb6035b4bcee6717d8a7417e8f8905d1b563 (patch)
tree8f2264d2de080477b225c2756e7496245934ae5d
parent4886621261c3b5fa2d9c75fd72d19ac186c9f970 (diff)
downloadjgit-5e5fbb6035b4bcee6717d8a7417e8f8905d1b563.tar.gz
jgit-5e5fbb6035b4bcee6717d8a7417e8f8905d1b563.zip
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>
-rw-r--r--org.eclipse.jgit.test/pom.xml4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java12
2 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml
index 266cc53a9a..f57323f465 100644
--- a/org.eclipse.jgit.test/pom.xml
+++ b/org.eclipse.jgit.test/pom.xml
@@ -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>
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 2da144c876..9236b4e821 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.FileOutputStream;
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 class RacyGitTests extends RepositoryTestCase {
}
}
- 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())));