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

big-r81 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8c5a7c48f133a9ba8b7a9fa9a7ffd4763d090759
Author: Dave Cottlehuber <[email protected]>
AuthorDate: Tue Nov 3 11:03:41 2026 +0000

    tweak disk_monitor_test.exs for very empty disks
    
    If the actual free / used space on a system rounds to 0%, the
    monitor gets confused. Instead of changing the observed behaviour
    by using the more obvious >= comparison, just pretend that -1 is
    the lower bound. Then everything should just work, and a user with
    an 80% limit will still see an 81% threshold, and not a 79% one.
---
 test/elixir/test/disk_monitor_test.exs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/elixir/test/disk_monitor_test.exs 
b/test/elixir/test/disk_monitor_test.exs
index 0b031483f..71396a0a3 100644
--- a/test/elixir/test/disk_monitor_test.exs
+++ b/test/elixir/test/disk_monitor_test.exs
@@ -3,6 +3,12 @@ defmodule DiskMonitorTest do
 
   @moduletag :disk_monitor
 
+  # The monitor blocks only when the percentage of disk used is strictly
+  # above the threshold. df reports 0% for a nearly empty filesystem (for
+  # example a fresh ZFS dataset on a FreeBSD CI jail), so a threshold of 0
+  # would never block there. Use -1 to block regardless of disk usage and
+  # 100 to never block.
+
   setup_all do
     set_config({"disk_monitor", "interactive_view_indexing_threshold", "100"})
     set_config({"disk_monitor", "background_view_indexing_threshold", "100"})
@@ -13,7 +19,7 @@ defmodule DiskMonitorTest do
 
   @tag :with_db
   test "block background view indexing", context do
-    set_config({"disk_monitor", "background_view_indexing_threshold", "0"})
+    set_config({"disk_monitor", "background_view_indexing_threshold", "-1"})
     set_config({"disk_monitor", "interactive_view_indexing_threshold", "100"})
 
     db_name = context[:db_name]
@@ -32,7 +38,7 @@ defmodule DiskMonitorTest do
   @tag :with_db
   test "block interactive view indexing", context do
     set_config({"disk_monitor", "background_view_indexing_threshold", "100"})
-    set_config({"disk_monitor", "interactive_view_indexing_threshold", "0"})
+    set_config({"disk_monitor", "interactive_view_indexing_threshold", "-1"})
 
     db_name = context[:db_name]
     resp = Couch.post("/#{db_name}", body: %{:_id => "foo"})
@@ -48,7 +54,7 @@ defmodule DiskMonitorTest do
 
   @tag :with_db
   test "block interactive database writes", context do
-    set_config({"disk_monitor", "interactive_database_writes_threshold", "0"})
+    set_config({"disk_monitor", "interactive_database_writes_threshold", "-1"})
 
     db_name = context[:db_name]
     resp = Couch.post("/#{db_name}", body: %{:_id => "foo"})

Reply via email to