Skip to content

Commit

Permalink
Merge branch 'ingela/inets/test-cuddle'
Browse files Browse the repository at this point in the history
* ingela/inets/test-cuddle:
  inets: Check ipv6 support with ct:require
  • Loading branch information
IngelaAndin committed Mar 28, 2019
2 parents feaf661 + f1bf22b commit 6258b10
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/inets/test/httpc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,6 @@ end_per_testcase(Case, Config)
end_per_testcase(_Case, _Config) ->
ok.

is_ipv6_supported() ->
case gen_udp:open(0, [inet6]) of
{ok, Socket} ->
gen_udp:close(Socket),
true;
_ ->
false
end.


%%--------------------------------------------------------------------
Expand Down Expand Up @@ -1612,7 +1604,8 @@ post_with_content_type(Config) when is_list(Config) ->

%%--------------------------------------------------------------------
request_options() ->
[{doc, "Test http get request with socket options against local server (IPv6)"}].
[{require, ipv6_hosts},
{doc, "Test http get request with socket options against local server (IPv6)"}].
request_options(Config) when is_list(Config) ->
Request = {url(group_name(Config), "/dummy.html", Config), []},
{ok, {{_,200,_}, [_ | _], _ = [_ | _]}} = httpc:request(get, Request, [],
Expand Down Expand Up @@ -2945,3 +2938,12 @@ receive_stream_n(Ref, N) ->
ct:pal("Data: ~p", [Data]),
receive_stream_n(Ref, N-1)
end.

is_ipv6_supported() ->
{ok, Hostname0} = inet:gethostname(),
try
lists:member(list_to_atom(Hostname0), ct:get_config(ipv6_hosts))
catch
_: _ ->
false
end.

0 comments on commit 6258b10

Please sign in to comment.