iilyak commented on code in PR #5373:
URL: https://github.com/apache/couchdb/pull/5373#discussion_r1901239968
##########
src/couch/test/eunit/couch_file_tests.erl:
##########
@@ -172,6 +185,101 @@ should_truncate(Fd) ->
ok = couch_file:truncate(Fd, Size),
?assertMatch({ok, foo}, couch_file:pread_term(Fd, 0)).
+should_set_db_pid(Fd) ->
+ FakeDbFun = fun() ->
+ receive
+ Reason -> exit(Reason)
+ end
+ end,
+ FakeDbPid1 = spawn(FakeDbFun),
+ ?assertEqual(ok, couch_file:set_db_pid(Fd, FakeDbPid1)),
+ % Now replace it with another one
+ FakeDbPid2 = spawn(FakeDbFun),
+ ?assertEqual(ok, couch_file:set_db_pid(Fd, FakeDbPid2)),
+ FakeDbPid1 ! die,
+ ?assertEqual(ok, couch_file:sync(Fd)),
+ ?assert(is_process_alive(Fd)),
+ % Can't monitor the couch_file or it won't register as idle and won't exit
Review Comment:
Thank you for the comment. This explains why `test_util:stop_sync/3` cannot
be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]