You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2019/04/28 16:43:47 UTC
[directory-server] branch master updated: Remove unreliable test.
Increase timeout for slow machines.
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git
The following commit(s) were added to refs/heads/master by this push:
new 9c39f9d Remove unreliable test. Increase timeout for slow machines.
9c39f9d is described below
commit 9c39f9d9ff6942897cc433c3957388296871565b
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sun Apr 28 18:43:33 2019 +0200
Remove unreliable test. Increase timeout for slow machines.
---
.../shared/client/api/LdapConnectionTest.java | 37 ----------------------
.../shared/client/api/LdapSSLConnectionTest.java | 21 +++++-------
2 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
index 71d0395..f00d6c5 100644
--- a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
+++ b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
@@ -31,7 +31,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.net.ServerSocket;
import java.util.HashMap;
import java.util.List;
@@ -369,42 +368,6 @@ public void testLookup() throws Exception
}
- /**
- * Create a server socket with low backlog and doesn't accept any connection. The operating system
- * only establishes a few TCP connections, then blocks TCP handshakes which should lead to client-side
- * timeout.
- *
- * TODO: verify if this test is reliable on all operating systems
- */
- @Test(expected = LdapException.class)
- public void testConnectionTimeout() throws LdapException, IOException
- {
- try
- {
- try ( ServerSocket ss = new ServerSocket( 0, 1 ) )
- {
- int port = ss.getLocalPort();
- for ( int i = 0; i < 100; i++ )
- {
- try ( LdapConnection connection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME, port ) )
- {
- connection.setTimeOut( 1000L );
- connection.connect();
- assertTrue( connection.isConnected() );
- }
- }
- }
- }
- catch ( Exception e )
- {
- assertThat( e, is( instanceOf( LdapException.class ) ) );
- assertThat( e.getMessage(), containsString( "ERR_04170_TIMEOUT_OCCURED" ) );
- assertThat( e.getMessage(), containsString( "TimeOut occurred" ) );
- throw e;
- }
- }
-
-
@Test
public void testConfigSetting() throws LdapException, IOException
{
diff --git a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
index 0ff67a5..a6a1c5a 100644
--- a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
+++ b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
@@ -30,11 +30,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.net.InetSocketAddress;
import java.net.ServerSocket;
-import java.nio.channels.AsynchronousServerSocketChannel;
-import java.nio.channels.AsynchronousSocketChannel;
-import java.nio.channels.CompletionHandler;
import java.util.List;
import javax.net.ssl.X509TrustManager;
@@ -64,7 +60,6 @@ import org.apache.directory.server.ldap.handlers.sasl.digestMD5.DigestMd5Mechani
import org.apache.directory.server.ldap.handlers.sasl.gssapi.GssapiMechanismHandler;
import org.apache.directory.server.ldap.handlers.sasl.ntlm.NtlmMechanismHandler;
import org.apache.directory.server.ldap.handlers.sasl.plain.PlainMechanismHandler;
-import org.apache.mina.util.AvailablePortFinder;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -398,7 +393,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
sslConfig.setLdapHost( "notexisting" );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( sslConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.connect();
}
catch ( Exception e )
@@ -417,7 +412,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
tlsConfig.setLdapHost( "notexisting" );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.startTls();
}
catch ( Exception e )
@@ -436,7 +431,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
sslConfig.setLdapPort( 123 );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( sslConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.connect();
}
catch ( Exception e )
@@ -455,7 +450,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
tlsConfig.setLdapPort( 123 );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.startTls();
}
catch ( Exception e )
@@ -474,7 +469,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
sslConfig.setLdapPort( getLdapServer().getPort() );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( sslConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.connect();
}
catch ( Exception e )
@@ -493,7 +488,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
tlsConfig.setLdapPort( getLdapServer().getPortSSL() );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.startTls();
}
catch ( Exception e )
@@ -519,7 +514,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
sslConfig.setLdapPort( port );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( sslConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.connect();
}
}
@@ -549,7 +544,7 @@ public class LdapSSLConnectionTest extends AbstractLdapTestUnit
tlsConfig.setLdapPort( port );
try ( LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig ) )
{
- connection.setTimeOut( 1000L );
+ connection.setTimeOut( 10000L );
connection.startTls();
}
}