summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-07-24 16:38:53 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-07-24 16:38:53 +0000
commitac3d047a6be45316681d9c6e507537231d1e0e0a (patch)
treef18976f0040ed32bf2772dc3cbc5d376da2f54ec /test
parent7b400c260c7c93bb24ff0e13dc2575af8751f35a (diff)
reassemble split chunks in changes feed, add all() export
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@797553 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rwxr-xr-xtest/etap/110-replication-changes-feed.t43
1 files changed, 41 insertions, 2 deletions
diff --git a/test/etap/110-replication-changes-feed.t b/test/etap/110-replication-changes-feed.t
index 9b5dec85..a3b1b8a7 100755
--- a/test/etap/110-replication-changes-feed.t
+++ b/test/etap/110-replication-changes-feed.t
@@ -22,7 +22,7 @@ main(_) ->
code:add_pathz("src/ibrowse"),
code:add_pathz("src/mochiweb"),
- etap:plan(12),
+ etap:plan(17),
case (catch test()) of
ok ->
etap:end_tests();
@@ -48,6 +48,7 @@ test() ->
couch_server:delete(<<"etap-test-db">>, []),
{ok, Db2} = couch_db:create(<<"etap-test-db">>, []),
test_all(remote),
+ test_remote_only(),
couch_db:close(Db2),
couch_server:delete(<<"etap-test-db">>, []),
@@ -59,7 +60,11 @@ test_all(Type) ->
test_since_parameter(Type),
test_continuous_parameter(Type),
test_conflicts(Type),
- test_deleted_conflicts(Type).
+ test_deleted_conflicts(Type),
+ test_non_blocking_call(Type).
+
+test_remote_only() ->
+ test_chunk_reassembly(remote).
test_unchanged_db(Type) ->
{ok, Pid} = couch_rep_changes_feed:start({Type, get_dbname(Type)}, []),
@@ -154,6 +159,40 @@ test_deleted_conflicts(Type) ->
io_lib:format("(~p) deleted conflict revisions show up in feed", [Type])
).
+test_non_blocking_call(Type) ->
+ Since = get_update_seq(),
+ {ok, Pid} = couch_rep_changes_feed:start({Type, get_dbname(Type)},
+ [{since, Since}, {continuous, true}]),
+ etap:is(
+ couch_rep_changes_feed:all(Pid),
+ [],
+ io_lib:format("(~p) all() returns empty list if no changes available",
+ [Type])
+ ),
+ Expect1 = generate_change(),
+ Expect2 = generate_change(),
+ timer:sleep(100),
+ etap:is(
+ couch_rep_changes_feed:all(Pid),
+ [Expect1, Expect2],
+ io_lib:format("(~p) all() returns full list of outstanding changes",
+ [Type])
+ ),
+ ok = couch_rep_changes_feed:stop(Pid).
+
+test_chunk_reassembly(Type) ->
+ Since = get_update_seq(),
+ Expect = [generate_change() || _I <- lists:seq(1,30)],
+ {ok, Pid} = couch_rep_changes_feed:start({Type, get_dbname(Type)},
+ [{since, Since}]),
+ timer:sleep(100),
+ etap:is(
+ couch_rep_changes_feed:all(Pid),
+ Expect,
+ io_lib:format("(~p) reassembles chunks split across TCP frames",
+ [Type])
+ ).
+
generate_change() ->
generate_change(couch_util:new_uuid()).