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