couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couch commit: updated refs/heads/master to f1bb186
Date Wed, 30 Sep 2015 17:45:36 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master e7e5cc84c -> f1bb186eb


Fix task status unit test dependency

It depends on couch_log to be running. Otherwise it
throw this error:

```
unexpected termination of test process*
::{{badmatch,undefined},
   [{couch_log,debug,2,[{file,"src/couch_log.erl"},{line,32}]},
    {couch_task_status,handle_cast,2,
                       [{file,"src/couch_task_status.erl"},{line,137}]},
```

And only 6 out of 11 tests are run.

COUCHDB-2832


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

Branch: refs/heads/master
Commit: f1bb186eb2cd1e1a4930fbe1feb2e060b1172e4e
Parents: e7e5cc8
Author: Nick Vatamaniuc <vatamane@gmail.com>
Authored: Wed Sep 30 13:16:39 2015 -0400
Committer: Nick Vatamaniuc <vatamane@gmail.com>
Committed: Wed Sep 30 13:16:39 2015 -0400

----------------------------------------------------------------------
 test/couch_task_status_tests.erl | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f1bb186e/test/couch_task_status_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_task_status_tests.erl b/test/couch_task_status_tests.erl
index f97a376..0227b64 100644
--- a/test/couch_task_status_tests.erl
+++ b/test/couch_task_status_tests.erl
@@ -19,14 +19,18 @@
 
 
 setup() ->
+    Ctx = test_util:start(?MODULE, [couch_log], [{dont_mock, [config]}]),
     {ok, TaskStatusPid} = couch_task_status:start_link(),
     TaskUpdaterPid = spawn(fun() -> loop() end),
-    {TaskStatusPid, TaskUpdaterPid}.
+    {TaskStatusPid, TaskUpdaterPid, Ctx}.
 
-teardown({TaskStatusPid, _}) ->
+
+teardown({TaskStatusPid, _, Ctx})->
     test_util:stop_sync_throw(TaskStatusPid, fun() ->
         couch_task_status:stop()
-    end, timeout_error, ?TIMEOUT).
+    end, timeout_error, ?TIMEOUT),
+    test_util:stop(Ctx).
+
 
 couch_task_status_test_() ->
     {
@@ -53,38 +57,38 @@ couch_task_status_test_() ->
     }.
 
 
-should_register_task({_, Pid}) ->
+should_register_task({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?_assertEqual(1, length(couch_task_status:all())).
 
-should_set_task_startup_time({_, Pid}) ->
+should_set_task_startup_time({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?_assert(is_integer(get_task_prop(Pid, started_on))).
 
-should_have_update_time_as_startup_before_any_progress({_, Pid}) ->
+should_have_update_time_as_startup_before_any_progress({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     StartTime = get_task_prop(Pid, started_on),
     ?_assertEqual(StartTime, get_task_prop(Pid, updated_on)).
 
-should_set_task_type({_, Pid}) ->
+should_set_task_type({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?_assertEqual(replication, get_task_prop(Pid, type)).
 
-should_not_register_multiple_tasks_for_same_pid({_, Pid}) ->
+should_not_register_multiple_tasks_for_same_pid({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?_assertEqual({add_task_error, already_registered},
                   call(Pid, add, [{type, compaction}, {progress, 0}])).
 
-should_set_task_progress({_, Pid}) ->
+should_set_task_progress({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?_assertEqual(0, get_task_prop(Pid, progress)).
 
-should_update_task_progress({_, Pid}) ->
+should_update_task_progress({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     call(Pid, update, [{progress, 25}]),
     ?_assertEqual(25, get_task_prop(Pid, progress)).
 
-should_update_time_changes_on_task_progress({_, Pid}) ->
+should_update_time_changes_on_task_progress({_, Pid, _Ctx}) ->
     ?_assert(
         begin
             ok = call(Pid, add, [{type, replication}, {progress, 0}]),
@@ -93,7 +97,7 @@ should_update_time_changes_on_task_progress({_, Pid}) ->
             get_task_prop(Pid, updated_on) > get_task_prop(Pid, started_on)
         end).
 
-%%should_control_update_frequency({_, Pid}) ->
+%%should_control_update_frequency({_, Pid, _Ctx}) ->
 %%    ?_assertEqual(66,
 %%        begin
 %%            ok = call(Pid, add, [{type, replication}, {progress, 0}]),
@@ -104,7 +108,7 @@ should_update_time_changes_on_task_progress({_, Pid}) ->
 %%            get_task_prop(Pid, progress)
 %%        end).
 
-should_reset_control_update_frequency({_, Pid}) ->
+should_reset_control_update_frequency({_, Pid, _Ctx}) ->
     ?_assertEqual(87,
         begin
             ok = call(Pid, add, [{type, replication}, {progress, 0}]),
@@ -120,7 +124,7 @@ should_reset_control_update_frequency({_, Pid}) ->
 should_track_multiple_tasks(_) ->
     ?_assert(run_multiple_tasks()).
 
-should_finish_task({_, Pid}) ->
+should_finish_task({_, Pid, _Ctx}) ->
     ok = call(Pid, add, [{type, replication}, {progress, 0}]),
     ?assertEqual(1, length(couch_task_status:all())),
     ok = call(Pid, done),


Mime
View raw message