From 237f9e7053dc2d326810c6c758a9ee8c513853b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 8 Nov 2016 19:32:29 +0200 Subject: Check for the SSL version for SNI instead of Makefile --- Makefile | 11 ++--------- test/acceptor_SUITE.erl | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 17b9a23..2ca9290 100644 --- a/Makefile +++ b/Makefile @@ -8,19 +8,12 @@ COMPILE_FIRST = ranch_transport CT_OPTS += -pa test -ct_hooks ranch_ct_hook [] PLT_APPS = crypto public_key ssl -CI_OTP_NO_SNI = \ +CI_OTP ?= \ OTP_R16B OTP_R16B01 OTP_R16B02 OTP_R16B03-1 \ - OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.6.6 -CI_OTP ?= $(CI_OTP_NO_SNI) \ + OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.6.6 \ OTP-18.0.3 OTP-18.1.5 OTP-18.2.4.1 OTP-18.3.4.4 \ OTP-19.0.7 OTP-19.1.5 -ifdef CI_OTP_RELEASE -ifneq ($(filter $(CI_OTP_RELEASE),$(CI_OTP_NO_SNI)),) -TEST_ERLC_OPTS += -DTEST_NO_SNI=1 -endif -endif - # Dependencies. TEST_DEPS = ct_helper diff --git a/test/acceptor_SUITE.erl b/test/acceptor_SUITE.erl index 33ccd41..547d1c0 100644 --- a/test/acceptor_SUITE.erl +++ b/test/acceptor_SUITE.erl @@ -134,14 +134,15 @@ ssl_echo(_) -> {'EXIT', _} = begin catch ranch:get_port(Name) end, ok. --ifdef(TEST_NO_SNI). ssl_sni_echo(_) -> - {skip, "No SNI support."}. + case application:get_key(ssl, vsn) of + {ok, Vsn} when Vsn >= "7.0" -> + do_ssl_sni_echo(); + _ -> + {skip, "No SNI support."} + end. -ssl_sni_fail(_) -> - {skip, "No SNI support."}. --else. -ssl_sni_echo(_) -> +do_ssl_sni_echo() -> doc("Ensure that SNI works with SSL transport."), Name = name(), Opts = ct_helper:get_certs_from_ets(), @@ -157,6 +158,14 @@ ssl_sni_echo(_) -> ok. ssl_sni_fail(_) -> + case application:get_key(ssl, vsn) of + {ok, Vsn} when Vsn >= "7.0" -> + do_ssl_sni_fail(); + _ -> + {skip, "No SNI support."} + end. + +do_ssl_sni_fail() -> doc("Ensure that connection fails when host is not in SNI list."), Name = name(), Opts = ct_helper:get_certs_from_ets(), @@ -167,7 +176,6 @@ ssl_sni_fail(_) -> %% Make sure the listener stopped. {'EXIT', _} = begin catch ranch:get_port(Name) end, ok. --endif. %% tcp. -- cgit v1.2.3