From 1c790063dc942779a4bb51324667272b03bd6e4c Mon Sep 17 00:00:00 2001 From: Russell Brown Date: Tue, 13 Aug 2013 13:14:56 -0400 Subject: [PATCH] Update test for 503 error response --- tests/secondary_index_tests.erl | 4 +++- tests/verify_2i_timeout.erl | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/secondary_index_tests.erl b/tests/secondary_index_tests.erl index 8978a94e..3bd9bb11 100644 --- a/tests/secondary_index_tests.erl +++ b/tests/secondary_index_tests.erl @@ -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. diff --git a/tests/verify_2i_timeout.erl b/tests/verify_2i_timeout.erl index 17ac921f..17e521ee 100644 --- a/tests/verify_2i_timeout.erl +++ b/tests/verify_2i_timeout.erl @@ -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, [])),