Просмотр исходного кода

Fix broken tests in loop_handler_SUITE

Loïc Hoguin 7 лет назад
Родитель
Сommit
d41f2914b0
2 измененных файлов с 6 добавлено и 5 удалено
  1. 3 2
      test/handlers/long_polling_h.erl
  2. 3 3
      test/loop_handler_SUITE.erl

+ 3 - 2
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}.

+ 3 - 3
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) ->