From 79cf49a82bd1e654f05b3be092ee11686ac2828c Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Wed, 27 Apr 2016 17:21:24 +0100 Subject: Avoid disappearing ETS tables in ssl_dist_SUITE When recording the fact that a verify function ran, spawn a new process to own the ETS table, to ensure that it's still there when we want to query it. --- lib/ssl/test/ssl_dist_SUITE.erl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/ssl/test/ssl_dist_SUITE.erl b/lib/ssl/test/ssl_dist_SUITE.erl index fa36b424ce..6aacc8ecf4 100644 --- a/lib/ssl/test/ssl_dist_SUITE.erl +++ b/lib/ssl/test/ssl_dist_SUITE.erl @@ -452,8 +452,16 @@ verify_fun_fail(Config) when is_list(Config) -> verify_fail_always(_Certificate, _Event, _State) -> %% Create an ETS table, to record the fact that the verify function ran. - ets:new(verify_fun_ran, [public, named_table, {heir, whereis(ssl_tls_dist_proxy), {}}]), - ets:insert(verify_fun_ran, {verify_fail_always_ran, true}), + %% Spawn a new process, to avoid the ETS table disappearing. + Parent = self(), + spawn( + fun() -> + ets:new(verify_fun_ran, [public, named_table]), + ets:insert(verify_fun_ran, {verify_fail_always_ran, true}), + Parent ! go_ahead, + timer:sleep(infinity) + end), + receive go_ahead -> ok end, {fail, bad_certificate}. %%-------------------------------------------------------------------- @@ -490,8 +498,16 @@ verify_fun_pass(Config) when is_list(Config) -> verify_pass_always(_Certificate, _Event, State) -> %% Create an ETS table, to record the fact that the verify function ran. - ets:new(verify_fun_ran, [public, named_table, {heir, whereis(ssl_tls_dist_proxy), {}}]), - ets:insert(verify_fun_ran, {verify_pass_always_ran, true}), + %% Spawn a new process, to avoid the ETS table disappearing. + Parent = self(), + spawn( + fun() -> + ets:new(verify_fun_ran, [public, named_table]), + ets:insert(verify_fun_ran, {verify_pass_always_ran, true}), + Parent ! go_ahead, + timer:sleep(infinity) + end), + receive go_ahead -> ok end, {valid, State}. %%-------------------------------------------------------------------- crl_check_pass() -> -- cgit v1.2.3