Commit 529ef2fb authored by Francesc Guasch's avatar Francesc Guasch
Browse files

refactor(test): retry to connect to LDAP server

parent c44eebb2
......@@ -300,7 +300,9 @@ sub _add_posix_group {
my $base = "ou=groups,".Ravada::Auth::LDAP::_dc_base();
my $mesg = $ldap->add(
my $mesg;
for ( 1 .. 10 ) {
$mesg = $ldap->add(
cn => $RAVADA_POSIX_GROUP
,dn => "cn=$RAVADA_POSIX_GROUP,$base"
,attrs => [ cn => $RAVADA_POSIX_GROUP
......@@ -308,9 +310,14 @@ sub _add_posix_group {
,gidNumber => 999
]
);
die "Error ".$mesg->code." adding $RAVADA_POSIX_GROUP ".$mesg->error
last if !$mesg->code;
warn "Error ".$mesg->code." adding $RAVADA_POSIX_GROUP ".$mesg->error
if $mesg->code && $mesg->code != 68;
Ravada::Auth::LDAP::init();
$ldap = Ravada::Auth::LDAP::_init_ldap_admin();
}
$mesg = $ldap->search( filter => "cn=$RAVADA_POSIX_GROUP",base => $base );
my @group = $mesg->entries;
ok($group[0],"Expecting group $RAVADA_POSIX_GROUP") or return;
......@@ -397,6 +404,7 @@ sub test_posix_group {
is($@,'');
ok($user_login);
Ravada::Auth::LDAP::init();
my $ldap = Ravada::Auth::LDAP::_init_ldap_admin();
my $mesg = $ldap->delete($user);
die $mesg->code." ".$mesg->error if $mesg->code && $mesg->code;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment