This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch auto-delete-3
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/auto-delete-3 by this push:
     new ac0624c3e tidier
ac0624c3e is described below

commit ac0624c3ed2d5ea0a9f9a2e05f4baf67ae26d4a2
Author: Robert Newson <[email protected]>
AuthorDate: Wed May 21 16:20:28 2025 +0100

    tidier
---
 test/elixir/test/drop_seq_test.exs | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/test/elixir/test/drop_seq_test.exs 
b/test/elixir/test/drop_seq_test.exs
index c62bfa647..28b29ef0c 100644
--- a/test/elixir/test/drop_seq_test.exs
+++ b/test/elixir/test/drop_seq_test.exs
@@ -124,6 +124,11 @@ defmodule DropSeqTest do
       wait_for_reshard_jobs_to_complete()
     end
 
+    after_doc_deletion_fn = fn ->
+      split_all_shard_ranges(db_name)
+      wait_for_reshard_jobs_to_complete()
+    end
+
     update_checkpoint_fn = fn ->
       resp = Couch.get("/#{db_name}")
       assert resp.status_code == 200
@@ -135,10 +140,15 @@ defmodule DropSeqTest do
       assert resp.status_code == 201
     end
 
-    checkpoint_test_helper(context[:db_name], create_checkpoint_fn, 
update_checkpoint_fn)
+    checkpoint_test_helper(context[:db_name],
+      create_checkpoint_fn, update_checkpoint_fn, after_doc_deletion_fn)
   end
 
   defp checkpoint_test_helper(db_name, create_checkpoint_fn, 
update_checkpoint_fn) do
+    checkpoint_test_helper(db_name, create_checkpoint_fn, 
update_checkpoint_fn, fn() -> true end)
+  end
+
+  defp checkpoint_test_helper(db_name, create_checkpoint_fn, 
update_checkpoint_fn, after_doc_deletion_fn) do
     doc_id = "testdoc"
 
     drop_count = get_drop_count(db_name)
@@ -157,6 +167,8 @@ defmodule DropSeqTest do
     resp = Couch.delete("/#{db_name}/#{doc_id}?rev=#{rev}")
     assert resp.status_code == 200
 
+    after_doc_deletion_fn.()
+
     # wait for drop seq to change
     wait_for_drop_seq_change(db_name, drop_seq, update_checkpoint_fn)
     assert get_drop_count(db_name) == drop_count
@@ -188,6 +200,20 @@ defmodule DropSeqTest do
     )
   end
 
+  defp split_all_shard_ranges(db_name) do
+    resp = Couch.get("/#{db_name}/_shards")
+    assert resp.status_code == 200
+    ranges = Map.keys(resp.body["shards"])
+    Enum.each(ranges, fn r ->
+      resp = Couch.post("/_reshard/jobs", body: %{
+        type: "split",
+        db: db_name,
+        range: r
+      })
+      assert resp.status_code == 201
+    end)
+  end
+
   defp wait_for_reshard_jobs_to_complete() do
     retry_until(
       fn ->

Reply via email to