From 3b8a1365d15ef6690160292902cf3fd1fd523fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 22 Jan 2013 14:22:28 +0100 Subject: Do not require inets for running tests anymore --- test/chunked_handler.erl | 2 ++ test/http_SUITE.erl | 14 +++++++++----- test/ws_SUITE.erl | 2 -- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/chunked_handler.erl b/test/chunked_handler.erl index 4a43c1a..e486afe 100644 --- a/test/chunked_handler.erl +++ b/test/chunked_handler.erl @@ -9,7 +9,9 @@ init({_Transport, http}, Req, _Opts) -> handle(Req, State) -> {ok, Req2} = cowboy_req:chunked_reply(200, Req), + timer:sleep(100), cowboy_req:chunk("chunked_handler\r\n", Req2), + timer:sleep(100), cowboy_req:chunk("works fine!", Req2), {ok, Req2, State}. diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 4791f36..61316db 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -155,7 +155,6 @@ groups() -> ]. init_per_suite(Config) -> - application:start(inets), application:start(crypto), application:start(ranch), application:start(cowboy), @@ -165,7 +164,6 @@ end_per_suite(_Config) -> application:stop(cowboy), application:stop(ranch), application:stop(crypto), - application:stop(inets), ok. init_per_group(http, Config) -> @@ -477,10 +475,16 @@ check_status(Config) -> {Ret, URL} end || {Status, URL} <- Tests]. -%% @todo Convert to cowboy_client. chunked_response(Config) -> - {ok, {{"HTTP/1.1", 200, "OK"}, _, "chunked_handler\r\nworks fine!"}} - = httpc:request(binary_to_list(build_url("/chunked_response", Config))). + Client = ?config(client, Config), + {ok, Client2} = cowboy_client:request(<<"GET">>, + build_url("/chunked_response", Config), Client), + {ok, 200, Headers, Client3} = cowboy_client:response(Client2), + true = lists:keymember(<<"transfer-encoding">>, 1, Headers), + {ok, Transport, Socket} = cowboy_client:transport(Client3), + {ok, <<"11\r\nchunked_handler\r\n\r\nB\r\nworks fine!\r\n0\r\n\r\n">>} + = Transport:recv(Socket, 44, 1000), + {error, closed} = cowboy_client:response(Client3). %% Check if sending requests whose size is around the MTU breaks something. echo_body(Config) -> diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index 92fd98b..61bb236 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -63,7 +63,6 @@ groups() -> [{ws, [], BaseTests}]. init_per_suite(Config) -> - application:start(inets), application:start(crypto), application:start(ranch), application:start(cowboy), @@ -73,7 +72,6 @@ end_per_suite(_Config) -> application:stop(cowboy), application:stop(ranch), application:stop(crypto), - application:stop(inets), ok. init_per_group(ws, Config) -> -- cgit v1.2.3