iilyak commented on a change in pull request #3766:
URL: https://github.com/apache/couchdb/pull/3766#discussion_r806791832
##########
File path: src/smoosh/test/smoosh_priority_queue_tests.erl
##########
@@ -0,0 +1,164 @@
+-module(smoosh_priority_queue_tests).
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("couch/include/couch_eunit.hrl").
+
+-define(PROP_PREFIX, "prop_").
+
+-define(CAPACITY, 3).
+
+-define(RANDOM_FILE, lists:flatten(io_lib:format("~p", [erlang:timestamp()]))).
Review comment:
The `smoosh_priority_queue:file_name/1` depend on `config:get("smoosh",
"state_dir", ".")`.
```
file_name(#priority_queue{name = Name}) ->
filename:join(config:get("smoosh", "state_dir", "."), Name ++
".waiting").
```
By default we would use `.` which means that we would pollute
`src/smoosh/.eunit` directory with temporary files. I think we should configure
default value for `[smoosh]->state_dir` in `rel/overide/etc/default.ini` and
override it for tests in `rel/plugins/eunit_plugin.erl` similarly as we do for
`[couchdb]->database_dir`.
`rel/plugins/eunit_plugin.erl`
```erlang
build_eunit_config(Config0, AppFile) ->
Cwd = filename:absname(rebar_utils:get_cwd()),
DataDir = Cwd ++ "/tmp/data",
...
Config4 = rebar_config:set_global(Config3, state_dir, DataDir),
```
`rel/overlay/etc/default.ini`
```ini
[smoosh]
state_dir = {{state_dir}}
```
[`configure`](https://github.com/apache/couchdb/blob/3.x/configure#L234:L261)
```
{state_dir, "./data"}.
```
`setup_eunit.template`
```
{variables, [
...
{data_dir, "/tmp"},
{prefix, "/tmp"},
{view_index_dir, "/tmp"},
{state_dir, "/tmp"}
]}.
...
```
`dev/run`
```python
@log("Prepare configuration files")
def setup_configs(ctx):
....
env = {
"state_dir": toposixpath(
ensure_dir_exists(ctx["devdir"], "lib", node, "data")
),
```
--
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]