aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-10-31 16:49:48 +0000
committerLoïc Hoguin <[email protected]>2017-10-31 16:49:48 +0000
commitd41f2914b0f7e52e669206d186c01a47e8113bf0 (patch)
tree07d53cb63e3c6e25a8b0c2c4c0555c7ffda8aedf
parentfb13e5c9e9dcdb73e2f12d50ccc827c6f395df00 (diff)
downloadcowboy-d41f2914b0f7e52e669206d186c01a47e8113bf0.tar.gz
cowboy-d41f2914b0f7e52e669206d186c01a47e8113bf0.tar.bz2
cowboy-d41f2914b0f7e52e669206d186c01a47e8113bf0.zip
Fix broken tests in loop_handler_SUITE
-rw-r--r--test/handlers/long_polling_h.erl5
-rw-r--r--test/loop_handler_SUITE.erl6
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) ->