From ee452fbecfee7ff8f72821e0897ebb5d0cc825a8 Mon Sep 17 00:00:00 2001 From: Samar Farooqi Date: Wed, 18 Nov 2026 18:58:23 +0000 Subject: [PATCH 1/3] Raise execute_command_until default timeout to 20 seconds Some engines publish $indexStats usage counters on a roughly 10-second cycle, so a counter read right after a query can stay at 0 for about 10 seconds. With a 10-second poll the counter often arrived on the last read, and under parallel load it sometimes missed it. A 20-second default gives twice that cycle. Polling still stops as soon as the predicate accepts a result, so the timeout only costs time when the state never appears. Signed-off-by: Samar Farooqi --- docs/testing/TEST_FORMAT.md | 2 +- documentdb_tests/framework/executor.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/testing/TEST_FORMAT.md b/docs/testing/TEST_FORMAT.md index 328532138..8eb92e23e 100644 --- a/docs/testing/TEST_FORMAT.md +++ b/docs/testing/TEST_FORMAT.md @@ -127,7 +127,7 @@ Use `execute_command_until()` only for state the server may publish asynchronous - The predicate checks that the state is present (for example, the counter is non-zero), not the value the test asserts. The assertion still judges the result. - Errors are never retried. An error result is returned at once. -- On timeout, the last result is returned so the assertion reports it. +- On timeout (20 seconds by default), the last result is returned so the assertion reports it. ```python # ✅ Good: wait until the counter is published, then assert on it diff --git a/documentdb_tests/framework/executor.py b/documentdb_tests/framework/executor.py index 7936c0f70..ced77f453 100644 --- a/documentdb_tests/framework/executor.py +++ b/documentdb_tests/framework/executor.py @@ -133,7 +133,7 @@ def execute_command_until( command: Dict, done: Callable[[Dict], bool], *, - timeout: float = 10.0, + timeout: float = 20.0, interval: float = 0.1, ) -> Any: """ @@ -148,6 +148,11 @@ def execute_command_until( timeout, the last result is returned as-is so the caller's assertion reports it. + The 20-second default is twice the roughly 10-second cycle on which some + engines publish usage counters, so a busy server still reports them + before the deadline. Polling ends as soon as ``done`` accepts a + result, so the timeout only costs time when the state never appears. + Args: collection: DocumentDB collection command: Command to execute via runCommand From 5a0af3920ac858361d19d1e8354f6b15fbd18a48 Mon Sep 17 00:00:00 2001 From: Samar Farooqi Date: Wed, 18 Nov 2026 19:00:35 +0000 Subject: [PATCH 2/3] Use a 15-second default for execute_command_until 15 seconds leaves about 5 seconds over the ~10-second counter cycle; the slowest counter read measured was 10.7 s. Signed-off-by: Samar Farooqi --- docs/testing/TEST_FORMAT.md | 2 +- documentdb_tests/framework/executor.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/testing/TEST_FORMAT.md b/docs/testing/TEST_FORMAT.md index 8eb92e23e..0cf8ab629 100644 --- a/docs/testing/TEST_FORMAT.md +++ b/docs/testing/TEST_FORMAT.md @@ -127,7 +127,7 @@ Use `execute_command_until()` only for state the server may publish asynchronous - The predicate checks that the state is present (for example, the counter is non-zero), not the value the test asserts. The assertion still judges the result. - Errors are never retried. An error result is returned at once. -- On timeout (20 seconds by default), the last result is returned so the assertion reports it. +- On timeout (15 seconds by default), the last result is returned so the assertion reports it. ```python # ✅ Good: wait until the counter is published, then assert on it diff --git a/documentdb_tests/framework/executor.py b/documentdb_tests/framework/executor.py index ced77f453..11a44f6e4 100644 --- a/documentdb_tests/framework/executor.py +++ b/documentdb_tests/framework/executor.py @@ -133,7 +133,7 @@ def execute_command_until( command: Dict, done: Callable[[Dict], bool], *, - timeout: float = 20.0, + timeout: float = 15.0, interval: float = 0.1, ) -> Any: """ @@ -148,10 +148,11 @@ def execute_command_until( timeout, the last result is returned as-is so the caller's assertion reports it. - The 20-second default is twice the roughly 10-second cycle on which some - engines publish usage counters, so a busy server still reports them - before the deadline. Polling ends as soon as ``done`` accepts a - result, so the timeout only costs time when the state never appears. + The 15-second default leaves about 5 seconds over the roughly 10-second + cycle on which some engines publish usage counters, so a busy server + still reports them before the deadline. Polling ends as soon as ``done`` + accepts a result, so the timeout only costs time when the state never + appears. Args: collection: DocumentDB collection From d1dcb74a948abbcc8a41bf7ec98d0ab13130da8b Mon Sep 17 00:00:00 2001 From: Samar Farooqi Date: Wed, 18 Nov 2026 19:09:52 +0000 Subject: [PATCH 3/3] Go back to a 20-second default for execute_command_until This reverts commit 5a0af39. 20 seconds gives twice the ~10-second counter cycle, and it is the limit the validation runs used. Signed-off-by: Samar Farooqi --- docs/testing/TEST_FORMAT.md | 2 +- documentdb_tests/framework/executor.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/testing/TEST_FORMAT.md b/docs/testing/TEST_FORMAT.md index 0cf8ab629..8eb92e23e 100644 --- a/docs/testing/TEST_FORMAT.md +++ b/docs/testing/TEST_FORMAT.md @@ -127,7 +127,7 @@ Use `execute_command_until()` only for state the server may publish asynchronous - The predicate checks that the state is present (for example, the counter is non-zero), not the value the test asserts. The assertion still judges the result. - Errors are never retried. An error result is returned at once. -- On timeout (15 seconds by default), the last result is returned so the assertion reports it. +- On timeout (20 seconds by default), the last result is returned so the assertion reports it. ```python # ✅ Good: wait until the counter is published, then assert on it diff --git a/documentdb_tests/framework/executor.py b/documentdb_tests/framework/executor.py index 11a44f6e4..ced77f453 100644 --- a/documentdb_tests/framework/executor.py +++ b/documentdb_tests/framework/executor.py @@ -133,7 +133,7 @@ def execute_command_until( command: Dict, done: Callable[[Dict], bool], *, - timeout: float = 15.0, + timeout: float = 20.0, interval: float = 0.1, ) -> Any: """ @@ -148,11 +148,10 @@ def execute_command_until( timeout, the last result is returned as-is so the caller's assertion reports it. - The 15-second default leaves about 5 seconds over the roughly 10-second - cycle on which some engines publish usage counters, so a busy server - still reports them before the deadline. Polling ends as soon as ``done`` - accepts a result, so the timeout only costs time when the state never - appears. + The 20-second default is twice the roughly 10-second cycle on which some + engines publish usage counters, so a busy server still reports them + before the deadline. Polling ends as soon as ``done`` accepts a + result, so the timeout only costs time when the state never appears. Args: collection: DocumentDB collection