summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache.test/tst/org
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2020-07-03 20:43:00 +0200
committerThomas Wolf <thomas.wolf@paranor.ch>2020-07-03 20:53:59 +0200
commit151f0cb82bacb678a4d0ff6eed4a04aacf1efa2e (patch)
tree69090570bd3119a7e27b48a92d18ad5971700ead /org.eclipse.jgit.ssh.apache.test/tst/org
parent8774f541904ca9afba1786b4da14c1aedf4dda78 (diff)
downloadjgit-151f0cb82bacb678a4d0ff6eed4a04aacf1efa2e.tar.gz
jgit-151f0cb82bacb678a4d0ff6eed4a04aacf1efa2e.zip
Add a test for upstream bug SSHD-1028
SSHD-1028:[1] server doesn't close server-side sessions properly when client disconnects. [1] https://issues.apache.org/jira/projects/SSHD/issues/SSHD-1028 Change-Id: I0d67f49e35abe8375cb1370a494dc01d0fb2c9b1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.ssh.apache.test/tst/org')
-rw-r--r--org.eclipse.jgit.ssh.apache.test/tst/org/eclipse/jgit/transport/sshd/ApacheSshTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.jgit.ssh.apache.test/tst/org/eclipse/jgit/transport/sshd/ApacheSshTest.java b/org.eclipse.jgit.ssh.apache.test/tst/org/eclipse/jgit/transport/sshd/ApacheSshTest.java
index bfee04219d..1b2f7f32f4 100644
--- a/org.eclipse.jgit.ssh.apache.test/tst/org/eclipse/jgit/transport/sshd/ApacheSshTest.java
+++ b/org.eclipse.jgit.ssh.apache.test/tst/org/eclipse/jgit/transport/sshd/ApacheSshTest.java
@@ -21,6 +21,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.sshd.client.config.hosts.KnownHostEntry;
+import org.apache.sshd.server.ServerFactoryManager;
+import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.junit.ssh.SshTestBase;
import org.eclipse.jgit.lib.Constants;
@@ -175,4 +177,31 @@ public class ApacheSshTest extends SshTestBase {
defaultCloneDir, null,
"IdentityFile " + privateKey1.getAbsolutePath());
}
+
+ /**
+ * Test for SSHD-1028. If the server doesn't close sessions, the second
+ * fetch will fail. Occurs on sshd 2.5.[01].
+ *
+ * @throws Exception
+ * on errors
+ * @see <a href=
+ * "https://issues.apache.org/jira/projects/SSHD/issues/SSHD-1028">SSHD-1028</a>
+ */
+ @Test
+ public void testPushWithSessionLimit() throws Exception {
+ server.getProperties().put(ServerFactoryManager.MAX_CONCURRENT_SESSIONS,
+ Integer.valueOf(2));
+ File localClone = cloneWith("ssh://localhost/doesntmatter",
+ defaultCloneDir, null, //
+ "Host localhost", //
+ "HostName localhost", //
+ "Port " + testPort, //
+ "User " + TEST_USER, //
+ "IdentityFile " + privateKey1.getAbsolutePath());
+ // Fetch a couple of times
+ try (Git git = Git.open(localClone)) {
+ git.fetch().call();
+ git.fetch().call();
+ }
+ }
}