You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/05/27 14:18:21 UTC

[GitHub] [nifi] gresockj commented on a change in pull request #5106: NIFI-8632: Using available port in StandardOidcIdentityProviderGroovy…

gresockj commented on a change in pull request #5106:
URL: https://github.com/apache/nifi/pull/5106#discussion_r640668874



##########
File path: nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/groovy/org/apache/nifi/registry/web/security/authentication/oidc/StandardOidcIdentityProviderGroovyIT.groovy
##########
@@ -58,17 +58,29 @@ import org.junit.runners.JUnit4
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
+import java.nio.channels.SocketChannel
+
 @RunWith(JUnit4.class)
-class StandardOidcIdentityProviderGroovyTest extends GroovyTestCase {
-    private static final Logger logger = LoggerFactory.getLogger(StandardOidcIdentityProviderGroovyTest.class)
+class StandardOidcIdentityProviderGroovyIT extends GroovyTestCase {
+    private static final Logger logger = LoggerFactory.getLogger(StandardOidcIdentityProviderGroovyIT.class)
 
     private static final Key SIGNING_KEY = new Key(id: 1, identity: "signingKey", key: "mock-signing-key-value")
 
+    private static int getAvailablePort() throws IOException {
+        SocketChannel socket = SocketChannel.open()
+        socket.setOption(StandardSocketOptions.SO_REUSEADDR, true)
+        socket.bind(new InetSocketAddress("localhost", 0))
+        return socket.socket().getLocalPort()
+    }

Review comment:
       Unfortunately, Groovy doesn't like the try-with-resources call in that method.  However, this helped me track down the Connection timeout issue!  I just needed to close the socket.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org