iilyak opened a new pull request #3921:
URL: https://github.com/apache/couchdb/pull/3921


   ## Overview
   
   The `fabric_rpc_tests` pollutes the state of `shards_db` which causes 
flakiness
   of other tests. This PR fixes the problem by configuring temporary 
`database_dir`.
   
   The important implementation detail is that we need to wait for all 
`couch_server`
   processes to restart. Before initroduction of sharded couch server in the
   https://github.com/apache/couchdb/pull/3366 this could be done as:
   
   ```erlang
   test_util:with_process_restart(couch_server, fun() ->
     config:set("couchdb", "database_dir", NewDatabaseDir)
   end),
   ```
   
   This method has to be updated to support sharded `couch_server`. Following 
auxiliary
   functions where added:
   
   - `couch_server:names/0` - returns list of registered names of each
     `couch_server` process
   - `test_util:with_processes_restart/{2,4}` - waits all process to be 
restarted
     returns `{Pids :: #{} | timeout, Res :: term()}`
   - `test_util:with_couch_server_restart/1` - waits for all `couch_server` 
processes
   to finish restart
   
   The new way of configuring `database_dir` in test suites is:
   
   ```erlang
   test_util:with_couch_server_restart(fun() ->
     config:set("couchdb", "database_dir", NewDatabaseDir)
   end),
   ```
   
   
   ## Testing recommendations
   
   `make eunit`
   
   ## Related Issues or Pull Requests
   
   - https://github.com/apache/couchdb/pull/3366
   
   ## Checklist
   
   - [x] Code is written and works correctly
   - [x] Changes are covered by tests
   - [ ] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [ ] A PR for documentation changes has been made in 
https://github.com/apache/couchdb-documentation
   


-- 
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]


Reply via email to