diff options
Diffstat (limited to 'lib/eldap/test/eldap_basic_SUITE.erl')
-rw-r--r-- | lib/eldap/test/eldap_basic_SUITE.erl | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/lib/eldap/test/eldap_basic_SUITE.erl b/lib/eldap/test/eldap_basic_SUITE.erl index 0ffb98c113..93d83d1f4e 100644 --- a/lib/eldap/test/eldap_basic_SUITE.erl +++ b/lib/eldap/test/eldap_basic_SUITE.erl @@ -64,33 +64,16 @@ groups() -> ]. init_per_suite(Config) -> - SSL_started = - try ssl:start() - of - ok -> true; - {error,{already_started,ssl}} -> true - catch - Error:Reason -> - ct:comment("ssl failed to start"), - ct:log("init_per_suite failed to start ssl Error=~p Reason=~p", [Error, Reason]), - false - end, - - case SSL_started of - true -> make_certs:all("/dev/null", - filename:join(?config(data_dir,Config), "certs")); - false -> ok - end, - + SSL_available = init_ssl_certs_et_al(Config), LDAP_server = find_first_server(false, [{config,eldap_server}, {config,ldap_server}, {"localhost",9876}]), LDAPS_server = - case SSL_started of + case SSL_available of true -> find_first_server(true, [{config,ldaps_server}, {"localhost",9877}]); false -> undefined end, - [{ssl_available, SSL_started}, + [{ssl_available, SSL_available}, {ldap_server, LDAP_server}, {ldaps_server, LDAPS_server} | Config]. @@ -635,3 +618,31 @@ supported_extension(OID, Config) -> _Ok = eldap:close(H), false end. + +%%%---------------------------------------------------------------- +init_ssl_certs_et_al(Config) -> + try ssl:start() + of + R when R==ok ; R=={error,{already_started,ssl}} -> + try make_certs:all("/dev/null", + filename:join(?config(data_dir,Config), "certs")) + of + {ok,_} -> true; + Other -> + ct:comment("make_certs failed"), + ct:log("make_certs failed ~p", [Other]), + false + catch + C:E -> + ct:comment("make_certs crashed"), + ct:log("make_certs failed ~p:~p", [C,E]), + false + end; + _ -> + false + catch + Error:Reason -> + ct:comment("ssl failed to start"), + ct:log("init_per_suite failed to start ssl Error=~p Reason=~p", [Error, Reason]), + false + end. |