From d41f2914b0f7e52e669206d186c01a47e8113bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 31 Oct 2017 16:49:48 +0000 Subject: Fix broken tests in loop_handler_SUITE --- test/handlers/long_polling_h.erl | 5 +++-- test/loop_handler_SUITE.erl | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/handlers/long_polling_h.erl b/test/handlers/long_polling_h.erl index 3dd0f77..f9da574 100644 --- a/test/handlers/long_polling_h.erl +++ b/test/handlers/long_polling_h.erl @@ -14,8 +14,9 @@ init(Req, _) -> {cowboy_loop, Req, 2, hibernate}. info(timeout, Req, 0) -> - %% @todo Why 102? - {stop, cowboy_req:reply(102, Req), 0}; + %% Send an unused status code to make sure there's no + %% conflict with whatever Cowboy may send itself. + {stop, cowboy_req:reply(<<"299 OK!">>, Req), 0}; info(timeout, Req, Count) -> erlang:send_after(200, self(), timeout), {ok, Req, Count - 1, hibernate}. diff --git a/test/loop_handler_SUITE.erl b/test/loop_handler_SUITE.erl index 6e7993f..6012b00 100644 --- a/test/loop_handler_SUITE.erl +++ b/test/loop_handler_SUITE.erl @@ -48,7 +48,7 @@ long_polling(Config) -> doc("Simple long-polling."), ConnPid = gun_open(Config), Ref = gun:get(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}]), - {response, fin, 102, _} = gun:await(ConnPid, Ref), + {response, fin, 299, _} = gun:await(ConnPid, Ref), ok. long_polling_body(Config) -> @@ -56,7 +56,7 @@ long_polling_body(Config) -> ConnPid = gun_open(Config), Ref = gun:post(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}], << 0:5000/unit:8 >>), - {response, fin, 102, _} = gun:await(ConnPid, Ref), + {response, fin, 299, _} = gun:await(ConnPid, Ref), ok. long_polling_body_too_large(Config) -> @@ -72,7 +72,7 @@ long_polling_pipeline(Config) -> ConnPid = gun_open(Config), Refs = [gun:get(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}]) || _ <- lists:seq(1, 2)], - _ = [{response, fin, 102, _} = gun:await(ConnPid, Ref) || Ref <- Refs], + _ = [{response, fin, 299, _} = gun:await(ConnPid, Ref) || Ref <- Refs], ok. loop_body(Config) -> -- cgit v1.2.3