couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [09/50] couch commit: updated refs/heads/2080-port-cors-to-chttpd to 529339b
Date Tue, 02 Jun 2015 19:35:40 GMT
Enable couch_changes_tests

COUCHDB-2547


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/2f51245e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/2f51245e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/2f51245e

Branch: refs/heads/2080-port-cors-to-chttpd
Commit: 2f51245e7cc69a69c3f77d81c3675ed01e9a2271
Parents: ca6607a
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Feb 10 08:46:23 2015 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Feb 10 11:07:36 2015 -0800

----------------------------------------------------------------------
 test/couch_changes_tests.erl | 43 +++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/2f51245e/test/couch_changes_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_changes_tests.erl b/test/couch_changes_tests.erl
index 7c5d487..315b8dc 100644
--- a/test/couch_changes_tests.erl
+++ b/test/couch_changes_tests.erl
@@ -24,9 +24,6 @@
     deleted = false
 }).
 
-
--ifdef(run_broken_tests).
-
 setup() ->
     DbName = ?tempdb(),
     {ok, Db} = create_db(DbName),
@@ -38,13 +35,18 @@ setup() ->
         save_doc(Db, {[{<<"_id">>, <<"doc5">>}]})
     ]],
     Rev = lists:nth(3, Revs),
-    {ok, Rev1} = save_doc(Db, {[{<<"_id">>, <<"doc3">>}, {<<"_rev">>,
Rev}]}),
+    couch_db:ensure_full_commit(Db),
+    {ok, Db1} = couch_db:reopen(Db),
+
+    Doc = couch_db:open_doc(Db1, <<"doc3">>),
+
+    {ok, Rev1} = save_doc(Db1, {[{<<"_id">>, <<"doc3">>}, {<<"_rev">>,
Rev}]}),
     Revs1 = Revs ++ [Rev1],
     Revs2 = Revs1 ++ [R || {ok, R} <- [
-        save_doc(Db, {[{<<"_id">>, <<"doc6">>}]}),
-        save_doc(Db, {[{<<"_id">>, <<"_design/foo">>}]}),
-        save_doc(Db, {[{<<"_id">>, <<"doc7">>}]}),
-        save_doc(Db, {[{<<"_id">>, <<"doc8">>}]})
+        save_doc(Db1, {[{<<"_id">>, <<"doc6">>}]}),
+        save_doc(Db1, {[{<<"_id">>, <<"_design/foo">>}]}),
+        save_doc(Db1, {[{<<"_id">>, <<"doc7">>}]}),
+        save_doc(Db1, {[{<<"_id">>, <<"doc8">>}]})
     ]],
     {DbName, list_to_tuple(Revs2)}.
 
@@ -258,7 +260,7 @@ should_filter_continuous_feed_by_specific_doc_ids({DbName, Revs}) ->
             DocIds = [<<"doc3">>, <<"doc4">>, <<"doc9999">>],
             Req = {json_req, {[{<<"doc_ids">>, DocIds}]}},
             Consumer = spawn_consumer(DbName, ChangesArgs, Req),
-            pause(Consumer),
+            ok = pause(Consumer),
 
             Rows = get_rows(Consumer),
             ?assertEqual(2, length(Rows)),
@@ -271,8 +273,9 @@ should_filter_continuous_feed_by_specific_doc_ids({DbName, Revs}) ->
             clear_rows(Consumer),
             {ok, _Rev9} = save_doc(Db, {[{<<"_id">>, <<"doc9">>}]}),
             {ok, _Rev10} = save_doc(Db, {[{<<"_id">>, <<"doc10">>}]}),
-            unpause(Consumer),
-            pause(Consumer),
+            ok = unpause(Consumer),
+            timer:sleep(100),
+            ok = pause(Consumer),
             ?assertEqual([], get_rows(Consumer)),
 
             Rev4 = element(4, Revs),
@@ -285,8 +288,9 @@ should_filter_continuous_feed_by_specific_doc_ids({DbName, Revs}) ->
             {ok, _} = save_doc(Db, {[{<<"_id">>, <<"doc12">>}]}),
             {ok, Rev3_3} = save_doc(Db, {[{<<"_id">>, <<"doc3">>},
                                           {<<"_rev">>, Rev3_2}]}),
-            unpause(Consumer),
-            pause(Consumer),
+            ok = unpause(Consumer),
+            timer:sleep(100),
+            ok = pause(Consumer),
 
             NewRows = get_rows(Consumer),
             ?assertEqual(2, length(NewRows)),
@@ -299,12 +303,13 @@ should_filter_continuous_feed_by_specific_doc_ids({DbName, Revs}) ->
             clear_rows(Consumer),
             {ok, _Rev3_4} = save_doc(Db, {[{<<"_id">>, <<"doc3">>},
                                            {<<"_rev">>, Rev3_3}]}),
-            unpause(Consumer),
-            pause(Consumer),
+            ok = unpause(Consumer),
+            timer:sleep(100),
+            ok = pause(Consumer),
 
             FinalRows = get_rows(Consumer),
 
-            unpause(Consumer),
+            ok = unpause(Consumer),
             stop_consumer(Consumer),
 
             ?assertMatch([#row{seq = 18, id = <<"doc3">>}], FinalRows)
@@ -530,7 +535,7 @@ spawn_consumer(DbName, ChangesArgs0, Req) ->
             false ->
                 ChangesArgs0
         end,
-        FeedFun = couch_changes:handle_changes(ChangesArgs, Req, Db),
+        FeedFun = couch_changes:handle_db_changes(ChangesArgs, Req, Db),
         try
             FeedFun({Callback, []})
         catch throw:{stop, _} ->
@@ -556,7 +561,7 @@ maybe_pause(Parent, Acc) ->
         {stop, Ref} ->
             Parent ! {ok, Ref},
             throw({stop, Acc});
-        V ->
+        V when V /= updated ->
             erlang:error({assertion_failed,
                       [{module, ?MODULE},
                        {line, ?LINE},
@@ -597,5 +602,3 @@ create_db(DbName) ->
 
 delete_db(DbName) ->
     ok = couch_server:delete(DbName, [?ADMIN_CTX]).
-
--endif.


Mime
View raw message