Currently, Durable Object alarms are not reset between test runs and do not respect isolated storage. You must delete or run all alarms with runDurableObjectAlarm() scheduled in each test before finishing the test, to ensure rouge alarms don't fire later.
To fix this, we should probably cancel all alarms in the abortAllDurableObjects() function:
https://github.com/cloudflare/workerd/blob/9651cc9b814b20d4674f1b0cba2e83ebbfbc8c38/src/workerd/api/unsafe.c%2B%2B#L102-L107
This function is called before/after each test when isolatedStorage is enabled, which is when we'd like all alarms to be cancelled. As far as I know, locally workerd uses an in-memory alarm scheduler, so it should be possible to clear these without needing to write to storage.
See https://github.com/cloudflare/workerd/blob/9651cc9b814b20d4674f1b0cba2e83ebbfbc8c38/src/workerd/server/server.c%2B%2B#L2534-L2551 for the workerd implementation of the abort all function.
Currently, Durable Object alarms are not reset between test runs and do not respect isolated storage. You must delete or run all alarms with runDurableObjectAlarm() scheduled in each test before finishing the test, to ensure rouge alarms don't fire later.
To fix this, we should probably cancel all alarms in the
abortAllDurableObjects()function:https://github.com/cloudflare/workerd/blob/9651cc9b814b20d4674f1b0cba2e83ebbfbc8c38/src/workerd/api/unsafe.c%2B%2B#L102-L107
This function is called before/after each test when
isolatedStorageis enabled, which is when we'd like all alarms to be cancelled. As far as I know, locallyworkerduses an in-memory alarm scheduler, so it should be possible to clear these without needing to write to storage.See https://github.com/cloudflare/workerd/blob/9651cc9b814b20d4674f1b0cba2e83ebbfbc8c38/src/workerd/server/server.c%2B%2B#L2534-L2551 for the
workerdimplementation of the abort all function.