nickva commented on a change in pull request #3779:
URL: https://github.com/apache/couchdb/pull/3779#discussion_r725762480



##########
File path: src/fabric/test/eunit/fabric_tests.erl
##########
@@ -0,0 +1,60 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(fabric_tests).
+
+
+-include_lib("couch/include/couch_eunit.hrl").
+
+
+cleanup_index_files_test_() ->
+    {
+        setup,
+        fun setup/0,
+        fun teardown/1,
+        fun(Ctx) -> [
+            t_cleanup_index_files(),
+            t_cleanup_index_files_with_existing_db(Ctx),
+            t_cleanup_index_files_with_deleted_db(Ctx)
+        ] end
+    }.
+
+
+setup() ->
+    test_util:start_couch([fabric]),
+    % TempDb is deleted in the test "t_cleanup_index_files_with_deleted_db".
+    TempDb = ?tempdb(),
+    fabric:create_db(TempDb),
+    TempDb.

Review comment:
       `setup/0` should normally return a context object, which would then be 
passed to the `teardown/1` function. It can also be passed to each test. In 
teardown/1 the context would be used to clean up or undo anything done in 
`setup/0`. 
   
   Since in `setup/0` we call `start_couch([fabric])` we get a context back, we 
should keep it so it can be passed to `teardown/1`. Currently, the way we 
return `TempDb` that would end up as the context, and then we'd end up calling 
`test_util:stop_couch(Ctx)` with a `TempDb`. So we should we'd return both as 
`{Ctx,` TempDb}`




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