Skip to content

Commit

Permalink
Correct intermittent fault in TLS test case
Browse files Browse the repository at this point in the history
Depending on timing the connection state in testcase t_tls_1_3_cert_expired
is either to-be-closed or already closed.
  • Loading branch information
bjosv committed Feb 16, 2021
1 parent 530bf93 commit ec15a36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/eredis_tls_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ t_tls_1_2_cert_expired(Config) when is_list(Config) ->
t_tls_1_3_cert_expired(Config) when is_list(Config) ->
ExtraOptions = [],
CertDir = "tls_expired_client_certs",
%%io:format(user, "## ~p~n", [ssl:cipher_suites(all, 'tlsv1.3')]),
C = c_tls(ExtraOptions, CertDir, [{versions, ['tlsv1.3']}]),
?assertMatch({error, {tls_alert, {certificate_expired, _}}}, eredis:q(C, ["GET", foo])),
%% Depending on timing the query will result in a tls_alert error,
%% but if the error indication was handled before sending the query
%% the connection has already been taken down, hence a no_connection
case eredis:q(C, ["GET", foo]) of
{error, {tls_alert, {certificate_expired, _}}} -> ok;
{error, no_connection} -> ok
end,
?assertMatch(ok, eredis:stop(C)).
-endif.
-endif.
Expand Down

0 comments on commit ec15a36

Please sign in to comment.