diff options
author | Nail Samatov <sanail@yandex.ru> | 2021-09-15 21:00:59 +0300 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2022-01-30 17:16:02 -0500 |
commit | 2b01ac3389c11be88ec875048d6a2cc4ed6903f1 (patch) | |
tree | 9891d1d9df4bb21a6646bebc79dad27caff37960 /org.eclipse.jgit.junit.http | |
parent | 8633ea4f07cbe10706a9edd1301f13aebe5be942 (diff) | |
download | jgit-2b01ac3389c11be88ec875048d6a2cc4ed6903f1.tar.gz jgit-2b01ac3389c11be88ec875048d6a2cc4ed6903f1.zip |
[test] Fix closing of test repositories
Fix tests failing on Windows because Repository instance is created but
not closed on tear down.
Fix repositories closed twice, except in tests that test this behavior
explicitly.
Name the temporary directories the tests run in after the test method;
that makes it easier to figure out in which tests repositories are
closed twice if it should occur again in the future.
Bug: 550111
Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980
Signed-off-by: Nail Samatov <sanail@yandex.ru>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.junit.http')
-rw-r--r-- | org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java index 3e7c84f667..877b918695 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.lib.AnyObjectId; @@ -80,7 +81,9 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase { */ protected TestRepository<Repository> createTestRepository() throws IOException { - return new TestRepository<>(createBareRepository()); + final FileRepository repository = createBareRepository(); + addRepoToClose(repository); + return new TestRepository<>(repository); } /** |