-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force use of IPv4 for LDAP test. #367
base: stable
Are you sure you want to change the base?
Conversation
Net::LDAP::Server::Test binds to IPv6 by default if IPv6 is enabled, but Net::LDAP uses 'localhost' which resolves to an IPv4 address. Even when I switched the call to Net::LDAP->new() to use ip6-localhost it failed elsewhere due to RT using 127.0.0.1.
Hmm, this makes me wonder what else currently expects localhost to be '127.0.0.1' vs. '::1'. Assuming you ran RTs tests on your IPv6 enabled system, are the LDAP tests the only ones that failed? |
I'm running the tests on a dual stack system. The LDAP tests are the only ones that fail for me without this patch. A quick grep on 5.0-trunk shows this:
|
I can't remember what broke when I tried using ip6-localhost, but switching to that will cause breakage on hosts which don't have IPv6 enabled. |
Oh, and given the amount of repeated code, standing up a test LDAP server feels like a good thing to abstract into a module. :) |
Yeah, that's a good thought. We have various helper modules for that reason, like lib/RT/Test.pm, lib/RT/Test/Email.pm, etc. Did you want to take a shot at updating your branch to move the that bit of LDAP server code to a module? |
That's what I get for opening my mouth. ;) I'm working on a new lib/RT/Test/LDAP.pm file. Fortunately this is trivial to run tests for! |
In the interests of not repeating code, let's centralise it.
I've pushed a commit which creates RT::Test::LDAP and changes all the tests for LDAP (ExternalAuth and LDAPImport) to use it. |
Net::LDAP::Server::Test binds to IPv6 by default if IPv6 is enabled, but Net::LDAP uses 'localhost' which resolves to an IPv4 address. Even when I switched the call to Net::LDAP->new() to use ip6-localhost it failed elsewhere due to RT using 127.0.0.1.