Update test for 503 error response

This commit is contained in:
Russell Brown 2013-08-13 13:14:56 -04:00
parent 016ab533d1
commit 1c790063dc
2 changed files with 6 additions and 3 deletions

View File

@ -218,7 +218,9 @@ http_stream_loop(Ref, Acc, {Boundary, BLen}=B) ->
Result),
http_stream_loop(Ref, Acc2, B);
{http, {Ref, stream, <<"\r\n--", Boundary:BLen/bytes, "--\r\n">>}} ->
http_stream_loop(Ref, Acc, B)
http_stream_loop(Ref, Acc, B);
Other -> lager:error("Unexpected message ~p", [Other]),
{error, unknown_message}
after 60000 ->
{error, timeout_local}
end.

View File

@ -47,9 +47,10 @@ confirm() ->
{ok, Res} = stream_pb(PBPid, Query, [{timeout, 5000}]),
?assertEqual(ExpectedKeys, proplists:get_value(keys, Res, [])),
{ok, {{_, 500, _}, _, Body}} = httpc:request(url("~s/buckets/~s/index/~s/~s~s",
{ok, {{_, 503, _}, _, Body}} = httpc:request(url("~s/buckets/~s/index/~s/~s~s",
[Http, ?BUCKET, <<"$bucket">>, ?BUCKET, []])),
?assertMatch({match, _}, re:run(Body, "{error,timeout}")), %% shows the app.config timeout
?assertMatch({match, _}, re:run(Body, "request timed out")), %% shows the app.config timeout
HttpRes = http_query(Http, Query, [{timeout, 5000}]),
?assertEqual(ExpectedKeys, proplists:get_value(<<"keys">>, HttpRes, [])),