Skip to content

Commit ecfb964

Browse files
DeusDataclaude
andcommitted
test(daemon): assert fast-fail by mechanism, not wall-clock, in the bootstrap ENOSPC test (DeusData#2113, O9)
The DeusData#1828 fail-fast test asserted `elapsed_ms < 5000`, a wall-clock budget that flaked on the ASan test-diag lane under CI contention while the fail-fast mechanism itself engaged correctly: the whole daemon_bootstrap suite ran in 11 s, so the test never reached the 30 s slow-timeout path -- it only overran the 5 s wall-clock budget. Per O9 a gate never asserts a transient timing window, and a rerun is not a fix. Drop the wall-clock measurement and rely on the deterministic mechanism the test already observes: the client surfaces the recorded ENOSPC cause verbatim ("failed to start" + errno + path), the slow "active or starting" timeout wording is absent, and exactly one daemon is spawned. That "failed to start" message is produced only on the fast-fail break (cbm_daemon_bootstrap_start_failure_format), never on the 30 s deadline path, so these assertions bind the fast-fail contract without any timing. Verified RED-on-revert: defeating the fast-fail detection makes the client hang to the 30 s deadline and report "active or starting", tripping ASSERT_FALSE(stale_wording). Full daemon_bootstrap suite green (28/28) under the ASan/UBSan build. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 0567dc7 commit ecfb964

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎tests/test_daemon_bootstrap.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,9 @@ TEST(daemon_bootstrap_start_failure_record_round_trip) {
10291029
* waiting the full 30 s and then reporting "active or starting" -- the
10301030
* opposite of the truth. A real host is spawned against a runtime directory
10311031
* whose record writes fail with ENOSPC; the client must report "failed to
1032-
* start" naming the errno and the path, within seconds, not the deadline. */
1032+
* start" naming the errno and the path by ending the wait on the recorded
1033+
* cause, not by exhausting the deadline. The proof is the surfaced record and
1034+
* the single spawn (see the assertions), never a wall-clock measurement. */
10331035
TEST(daemon_bootstrap_fails_fast_when_daemon_dies_at_publication) {
10341036
const char *old_cache = getenv("CBM_CACHE_DIR");
10351037
char *saved_cache = old_cache ? cbm_strdup(old_cache) : NULL;
@@ -1071,13 +1073,10 @@ TEST(daemon_bootstrap_fails_fast_when_daemon_dies_at_publication) {
10711073
cbm_daemon_bootstrap_result_t result;
10721074
memset(&result, 0, sizeof(result));
10731075
cbm_daemon_bootstrap_status_t status = CBM_DAEMON_BOOTSTRAP_FAILED;
1074-
uint64_t elapsed_ms = UINT64_MAX;
10751076
if (identity_ready) {
10761077
cbm_daemon_ipc_posix_record_write_failure_set_for_test(ENOSPC);
10771078
cbm_daemon_bootstrap_spawn_override_set_for_test(bootstrap_enospc_host_spawn, &host);
1078-
uint64_t started = cbm_now_ms();
10791079
status = cbm_daemon_bootstrap_execute(&config, &result);
1080-
elapsed_ms = cbm_now_ms() - started;
10811080
cbm_daemon_bootstrap_spawn_override_set_for_test(NULL, NULL);
10821081
cbm_daemon_ipc_posix_record_write_failure_set_for_test(0);
10831082
}
@@ -1115,7 +1114,14 @@ TEST(daemon_bootstrap_fails_fast_when_daemon_dies_at_publication) {
11151114
ASSERT_TRUE(host.child_count >= 1);
11161115
ASSERT_TRUE(log_read);
11171116
ASSERT_TRUE(daemon_named_cause);
1118-
ASSERT(elapsed_ms < 5000);
1117+
/* Fast-fail is proven by the MECHANISM, never by wall-clock (O9: a gate
1118+
* never asserts a transient timing window). The recorded ENOSPC cause is
1119+
* surfaced verbatim ("failed to start" + errno + path) and the slow
1120+
* "active or starting" timeout wording is absent -- that message is emitted
1121+
* ONLY on the fast-fail break (cbm_daemon_bootstrap_start_failure_format),
1122+
* never on the 30 s deadline path -- and the client stopped after exactly
1123+
* one spawn instead of respawning a doomed daemon until the deadline. Any
1124+
* regression to the pre-#1828 30 s hang trips these deterministically. */
11191125
ASSERT_FALSE(stale_wording);
11201126
ASSERT_TRUE(message_names_failure);
11211127
ASSERT_TRUE(message_names_errno);

0 commit comments

Comments
 (0)