iilyak commented on issue #1629: handle db deletion in load validation funs
URL: https://github.com/apache/couchdb/pull/1629#issuecomment-440293821
 
 
   > Comparing
   > 
   > ```
   > $ make eunit skip_tests+=couch_epep apps=couch suites=couchdb_db_tests
   > module 'couchdb_db_tests'
   >   Checking clustered db API
   >     DB deletion
   >       couchdb_db_tests:53: should_close_deleted_db...[0.029 s] ok
   >       couchdb_db_tests:68: 
should_kill_caller_from_load_validation_funs_for_deleted_db...[0.033 s] ok
   > =======================================================
   >   2 tests passed.
   > ```
   > 
   > with
   > 
   > ```
   > $ make eunit skip_tests+=couch_epep apps=ddoc_cache 
suites=ddoc_cache_open_test
   > module 'ddoc_cache_open_test'
   >   ddoc_cache_open_test: check_open_error_test_...ok
   >   ddoc_cache_open_test: check_open_error_test_...[0.012 s] ok
   >   ddoc_cache_open_test: check_open_error_test_...[0.015 s] ok
   >   ddoc_cache_open_test: check_open_error_test_...ok
   > =======================================================
   >   All 4 tests passed.
   > ```
   > 
   > I know it requires more boiler plate to accomplish, but I much prefer to 
see the actual names of the tests being run with the couchdb_db_tests module. 
Just seeing 4 identical lines of `ddoc_cache_open_test: check_open_error_test_` 
isn't as useful, IMO.
   
   I don't know how to do it with `with`. All tests in ddoc_cache application 
rely on combination of `ddoc_cache_tutil:start_couch` and `{setup, _, _, {with, 
Tests}}` construct. The `{with, Tests}` construct is implemented via shortcut 
in 
https://github.com/erlang/otp/blob/master/lib/eunit/src/eunit_data.erl#L294:L295.
 The author didn't take into account that the `{with, X, Tests}` construction 
rely on the 
[`eunit_lib:fun_parent(A)`](https://github.com/erlang/otp/blob/master/lib/eunit/src/eunit_lib.erl#L379:L390).
 The reason the hack doesn't get correct name of the test is because they are 
wrapping the function one more time on dispatch. 
   ```
   parse({setup, P, S, C, {with, As}}) when is_list(As) ->
        parse({setup, P, S, C, fun (X) -> {with, X, As} end});
   ```
   
   I am trying few things to avoid rewriting of all tests for the whole 
application.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to