summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2017-05-14 11:34:00 +0200
committerJan Lehnardt <jan@apache.org>2017-05-14 11:34:00 +0200
commit0425783abc86fb118d74d2188d6fcb7a151acd85 (patch)
tree4b88581a930ec4405240f557fa6139abcc47d8cd
parenta9d709714825606c2760bd30854b8c1db464d866 (diff)
downloadcouchdb-3415/test-debugging.tar.gz
chore: add debugging for failing test case, see COUCHDB-34153415/test-debugging
-rw-r--r--src/chttpd/test/chttpd_db_test.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/chttpd/test/chttpd_db_test.erl b/src/chttpd/test/chttpd_db_test.erl
index b7ea7f006..02d74ad94 100644
--- a/src/chttpd/test/chttpd_db_test.erl
+++ b/src/chttpd/test/chttpd_db_test.erl
@@ -86,7 +86,17 @@ should_accept_live_as_an_alias_for_continuous(Url) ->
?_test(begin
{ok, _, _, ResultBody} =
test_request:get(Url ++ "/_changes?feed=live&timeout=1", [?AUTH]),
- {ResultJson} = ?JSON_DECODE(ResultBody),
+ % https://issues.apache.org/jira/browse/COUCHDB-3415?filter=12340503
+ % if the decode fails, print out ResultBody, so we can debug what
+ % extra data is coming in.
+ {ResultJson} = try ?JSON_DECODE(ResultBody) of
+ Json -> Json
+ catch
+ throw:Error ->
+ io:format(user, "~nJSON_DECODE error: ~p~n", [Error]),
+ io:format(user, "~nOffending String: ~p~n", [ResultBody]),
+ ?assert(false) % should not happen, abort
+ end,
<<LastSeqNum0:1/binary, "-", _/binary>> = couch_util:get_value(
<<"last_seq">>, ResultJson, undefined),
LastSeqNum = list_to_integer(binary_to_list(LastSeqNum0)),