You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/11/22 17:51:38 UTC

git commit: Add more tests to 074-doc-update-conflicts.t

Updated Branches:
  refs/heads/master 9292f8dd1 -> 82441c123


Add more tests to 074-doc-update-conflicts.t


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

Branch: refs/heads/master
Commit: 82441c1231b755946011c3188e3c383bf0f39af5
Parents: 9292f8d
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Tue Nov 22 14:22:31 2011 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Tue Nov 22 14:23:46 2011 +0000

----------------------------------------------------------------------
 test/etap/074-doc-update-conflicts.t |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/82441c12/test/etap/074-doc-update-conflicts.t
----------------------------------------------------------------------
diff --git a/test/etap/074-doc-update-conflicts.t b/test/etap/074-doc-update-conflicts.t
index 7a1d820..d1be3ae 100755
--- a/test/etap/074-doc-update-conflicts.t
+++ b/test/etap/074-doc-update-conflicts.t
@@ -26,7 +26,7 @@ test_db_name() -> <<"couch_test_update_conflicts">>.
 main(_) ->
     test_util:init_code_path(),
 
-    etap:plan(10),
+    etap:plan(15),
     case (catch test()) of
         ok ->
             etap:end_tests();
@@ -39,6 +39,7 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
+    couch_config:set("couchdb", "delayed_commits", "true", false),
 
     lists:foreach(
         fun(NumClients) -> test_concurrent_doc_update(NumClients) end,
@@ -103,6 +104,7 @@ test_concurrent_doc_update(NumClients) ->
         NumConflicts,
         NumClients - 1,
         "Got " ++ ?i2l(NumClients - 1) ++ " client conflicts"),
+
     {ok, Db2} = couch_db:open_int(test_db_name(), []),
     {ok, Doc2} = couch_db:open_doc(Db2, <<"foobar">>, []),
     ok = couch_db:close(Db2),
@@ -112,7 +114,18 @@ test_concurrent_doc_update(NumClients) ->
         SavedValue,
         "Persisted doc has the right value"),
 
-    delete_db(Db).
+    ok = timer:sleep(1000),
+    etap:diag("Restarting the server"),
+    couch_server_sup:stop(),
+    ok = timer:sleep(1000),
+    couch_server_sup:start_link(test_util:config_files()),
+
+    {ok, Db3} = couch_db:open_int(test_db_name(), []),
+    {ok, Doc3} = couch_db:open_doc(Db3, <<"foobar">>, []),
+    ok = couch_db:close(Db3),
+    etap:is(Doc3, Doc2, "Got same document after server restart"),
+
+    delete_db(Db3).
 
 
 spawn_client(Doc) ->