diff options
author | Ali Sabil <[email protected]> | 2013-06-07 12:01:01 +0200 |
---|---|---|
committer | Ali Sabil <[email protected]> | 2013-06-07 12:01:01 +0200 |
commit | fdd67b72a37bb712c5707072464ce0b1a200380c (patch) | |
tree | deac088e18ef48e0c230429a08c314593cbf4e1d /test | |
parent | 1fc69977da8f57d5d3fa48cd68280aa2c0b1d78b (diff) | |
download | cowboy-fdd67b72a37bb712c5707072464ce0b1a200380c.tar.gz cowboy-fdd67b72a37bb712c5707072464ce0b1a200380c.tar.bz2 cowboy-fdd67b72a37bb712c5707072464ce0b1a200380c.zip |
Fix the reading of the localhost MTU in the HTTP tests
Sometimes the localhost interface has a different name from "lo",
this fix adds a helper function to read the MTU value when the
interface name starts with "lo".
Diffstat (limited to 'test')
-rw-r--r-- | test/http_SUITE.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 2d7f420..9470f44 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -420,6 +420,15 @@ body_to_chunks(ChunkSize, Body, Acc) -> body_to_chunks(ChunkSize, Rest, [<< ChunkSizeBin/binary, "\r\n", Chunk/binary, "\r\n" >>|Acc]). +get_mtu() -> + {ok, Interfaces} = inet:getiflist(), + [LocalInterface | _] = lists:filter(fun + ("lo" ++ _) -> true; + (_) -> false + end, Interfaces), + {ok, [{mtu, MTU}]} = inet:ifget(LocalInterface, [mtu]), + MTU. + %% Tests. check_raw_status(Config) -> @@ -517,7 +526,7 @@ chunked_response(Config) -> %% Check if sending requests whose size is around the MTU breaks something. echo_body(Config) -> Client = ?config(client, Config), - {ok, [{mtu, MTU}]} = inet:ifget("lo", [mtu]), + MTU = get_mtu(), _ = [begin Body = list_to_binary(lists:duplicate(Size, $a)), {ok, Client2} = cowboy_client:request(<<"POST">>, |