Subject: | Unable to listen on port 10636: Address already in use |
The tests for this module regularly fail to complete because (for whatever reason) they aren't
cleanly finishing with the test port.
e.g.:
➔ prove -lr t/
t/01-basic.t .................. 1/2 # Testing Catalyst::Authentication::Store::LDAP version 1.013
# Testing Catalyst version 5.80032
t/01-basic.t .................. ok
t/02-realms_api.t ............. Creating new LDAP server on port 10636 ...
t/02-realms_api.t ............. 1/5 Accepted connection from: 127.0.0.1
... shutting down server
t/02-realms_api.t ............. ok
t/03-entry_class.t ............ Creating new LDAP server on port 10636 ...
t/03-entry_class.t ............ 1/6 Accepted connection from: 127.0.0.1
... shutting down server
t/03-entry_class.t ............ ok
t/04-user_class.t ............. Creating new LDAP server on port 10636 ...
t/04-user_class.t ............. 1/8 Accepted connection from: 127.0.0.1
Creating new LDAP server on port 10636 ...
Unable to listen on port 10636: Address already in use at /opt/xt/xt-
perl/lib/site_perl/5.14.2/Net/LDAP/Server/Test.pm line 852.
... shutting down server
It seems to happen *every* time I run the tests locally.
I tried using Net::EmptyPort::wait_port() [from Test::TCP >= 1.20] bit it gave unexpected and
worse results.
I also tried empty_port() with no success. [example in attached patch]
I'm not sure what the 'best' solution is but this is a regular blocker for the internal perl+cpan
RPM build at NAP.
I could distropref out the test, but I'd prefer not to if there are better solutions.
Any thoughts?
Subject: | ldap_port.patch.txt |
diff -Naur Catalyst-Authentication-Store-LDAP-1.013/Makefile.PL Catalyst-Authentication-Store-LDAP-1.013.patched/Makefile.PL
--- Catalyst-Authentication-Store-LDAP-1.013/Makefile.PL 2013-01-09 14:43:26.000000000 +0000
+++ Catalyst-Authentication-Store-LDAP-1.013.patched/Makefile.PL 2013-03-12 12:25:56.000000000 +0000
@@ -14,6 +14,7 @@
build_requires('Test::More');
build_requires('Test::MockObject');
build_requires('Test::Exception');
+build_requires('Test::TCP' => '1.20');
resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Authentication-Store-LDAP/trunk/';
diff -Naur Catalyst-Authentication-Store-LDAP-1.013/t/lib/LDAPTest.pm Catalyst-Authentication-Store-LDAP-1.013.patched/t/lib/LDAPTest.pm
--- Catalyst-Authentication-Store-LDAP-1.013/t/lib/LDAPTest.pm 2013-03-12 12:16:23.000000000 +0000
+++ Catalyst-Authentication-Store-LDAP-1.013.patched/t/lib/LDAPTest.pm 2013-03-12 12:20:12.000000000 +0000
@@ -5,7 +5,9 @@
use Net::LDAP::Server::Test;
use Net::LDAP::Entry;
-sub server_port {10636}
+use Net::EmptyPort 'empty_port';
+
+sub server_port { return empty_port(); }
sub server_host { 'ldap://127.0.0.1:' . server_port() }
sub spawn_server {