summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-01-23 08:27:12 +0100
committerRobin Rosenberg <robin.rosenberg@dewire.com>2013-01-23 08:27:12 +0100
commite522d95a51422e76e3da1b781b24142ad65abcc9 (patch)
tree23b73be32d741c98285a43cb83fc9979c5f67a82 /org.eclipse.jgit.test
parentdb341527949fe98e56a0a463f74c55398f005a45 (diff)
downloadjgit-e522d95a51422e76e3da1b781b24142ad65abcc9.tar.gz
jgit-e522d95a51422e76e3da1b781b24142ad65abcc9.zip
Attempt to stabilize GCTest
File system time stamps and System.currentTimeMillis() may not necessarily be running on the same clock so add some slack. Bug: 396662 Change-Id: I25204d9e3181e15368da2902447518c6ce205017
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java
index 8b6c003888..820a8ae07e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/GCTest.java
@@ -304,6 +304,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
public void nonReferencedExpiredObject_pruned() throws Exception {
RevBlob a = tr.blob("a");
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertFalse(repo.hasObject(a));
}
@@ -313,6 +314,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
RevBlob a = tr.blob("a");
RevTree t = tr.tree(tr.file("a", a));
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertFalse(repo.hasObject(t));
assertFalse(repo.hasObject(a));
@@ -336,6 +338,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
RevBlob a = tr.blob("a");
tr.lightweightTag("t", a);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertTrue(repo.hasObject(a));
}
@@ -347,6 +350,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
tr.lightweightTag("t", t);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertTrue(repo.hasObject(t));
assertTrue(repo.hasObject(a));
@@ -357,6 +361,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
RevCommit tip = commitChain(10);
tr.branch("b").update(tip);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
do {
assertTrue(repo.hasObject(tip));
@@ -376,6 +381,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
update.setForceUpdate(true);
update.delete();
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertTrue(gc.getStatistics().numberOfLooseObjects == 0);
}
@@ -404,6 +410,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
update.delete();
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
assertTrue(repo.hasObject(b2Tip));
}
@@ -532,6 +539,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
assertEquals(0, stats.numberOfPackedObjects);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.gc();
stats = gc.getStatistics();
assertEquals(0, stats.numberOfLooseObjects);
@@ -581,6 +589,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
assertEquals(8, stats.numberOfLooseObjects);
assertEquals(0, stats.numberOfPackedObjects);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.gc();
stats = gc.getStatistics();
assertEquals(0, stats.numberOfLooseObjects);
@@ -640,6 +649,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
assertEquals(9, stats.numberOfLooseObjects);
assertEquals(0, stats.numberOfPackedObjects);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.gc();
stats = gc.getStatistics();
assertEquals(0, stats.numberOfLooseObjects);
@@ -657,6 +667,7 @@ public class GCTest extends LocalDiskRepositoryTestCase {
stats = gc.getStatistics();
assertEquals(8, stats.numberOfLooseObjects);
gc.setExpireAgeMillis(0);
+ fsTick();
gc.prune(Collections.<ObjectId> emptySet());
stats = gc.getStatistics();
assertEquals(8, stats.numberOfLooseObjects);