Skip Menu |

This queue is for tickets about the Test-Net-LDAP CPAN distribution.

Report information
The Basics
Id: 86696
Status: resolved
Priority: 0/
Queue: Test-Net-LDAP

People
Owner: MAHIRO [...] cpan.org
Requestors: cperello [...] zentyal.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Missing Test::Net::LDAP::root_dse method implementation
Date: Thu, 04 Jul 2013 09:48:10 +0200
To: bug-Test-Net-LDAP [...] rt.cpan.org
From: Carlos Perelló Marín <cperello [...] zentyal.com>
Hi, We are starting using this perl module for unit testing our software. However, we are using Net::LDAP::root_dse method and it's not implemented in your Test implementation. I did a basic implementation that works for us. You have the patch attached. Also, just in case you are interested, I packaged it as an .deb package (with my patch included) and published it at https://launchpad.net/~carlos/+archive/zentyal Cheers and thanks for your work. -- Carlos Perelló Marín - R&D mailto:cperello@zentyal.com The Linux small business server www.zentyal.com | www.twitter.com/zentyal

Message body is not shown because sender requested not to inline it.

Thanks for the feedback and input. It is a good idea to add root_dse. I like how you came up with your implementation. From the generality standpoint, however, I'd suggest a little different approach, as the topmost DN can be anything (e.g. configurable in slapd.conf for the OpenLDAP server) and not always be 'dc=xyz'. Here is how I plan to implement what makes root_dse work in testing: ldap_mockify { # Here is a test fixture to make up your server behavior my $ldap = Net::LDAP->new(...); $ldap->mock_root_dse( namingContexts => 'dc=example,dc=com', supportedLDAPVersion => 3, ); # ... # Start testing # ... # Now, this should return the intended namingContexts value my $root = $ldap->root_dse; is($root->get_value('namingContexts'), 'dc=example,dc=com'); }; Hope this will work for your use case as well. Feel free to get back to me with any questions or more feedback. Thanks, Mahiro
Subject: Re: [rt.cpan.org #86696] Missing Test::Net::LDAP::root_dse method implementation
Date: Thu, 11 Jul 2013 16:33:48 +0200
To: bug-Test-Net-LDAP [...] rt.cpan.org
From: Carlos Perelló Marín <cperello [...] zentyal.com>
Hi, On sáb, 2013-07-06 at 21:50 -0400, Mahiro Ando via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=86696 > > > Thanks for the feedback and input. It is a good idea to add root_dse. > > I like how you came up with your implementation. > > From the generality standpoint, however, I'd suggest a little different > approach, as the topmost DN can be anything (e.g. configurable in slapd.conf > for the OpenLDAP server) and not always be 'dc=xyz'.
Ok, makes sense. Show quoted text
> > Here is how I plan to implement what makes root_dse work in testing: > > ldap_mockify { > # Here is a test fixture to make up your server behavior > my $ldap = Net::LDAP->new(...); > $ldap->mock_root_dse( > namingContexts => 'dc=example,dc=com', > supportedLDAPVersion => 3, > ); > # ... > # Start testing > # ... > # Now, this should return the intended namingContexts value > my $root = $ldap->root_dse; > is($root->get_value('namingContexts'), 'dc=example,dc=com'); > }; > > Hope this will work for your use case as well. Feel free to get back to me with > any questions or more feedback.
Yeah, it fits my use case. However, the cache of the root_dse entry makes it a bit hard to use for testing purposes. I guess that having a way to clear the cache without changing it manually would be ideal... Anyway, I updated my code to use your new API and released updated packages for Ubuntu at https://launchpad.net/~carlos/+archive/zentyal Thank you! Show quoted text
> > Thanks, > Mahiro >
-- Carlos Perelló Marín - R&D mailto:cperello@zentyal.com The Linux small business server www.zentyal.com | www.twitter.com/zentyal