gristlabs_grist-core/test
Dmitry S 2705d41c34 (core) Add timeouts to prevent ActiveDoc bad state during shutdown.
Summary:
Add two shutdown-related timeouts.

1. One is to limit the duration of any work that happens once shutdown
   begins. In particular, waiting for an update to current time could block
   indefinitely if the data engine is unresponsive. Such awaits are now
   limited to 5 seconds.

2. The other is to allow documents to get shutdown for inactivity even when
   some work takes forever. Certain work (e.g. applying user actions)
   generally prevents a document from shutting down while it's pending. This
   prevention is now limited to 5 minutes.

   Shutting down a doc while something is pending may break some
   assumptions, and lead to errors. The timeout is long to let us assume
   that the work is stuck, and that errors are better than waiting forever.

Other changes:
- Periodic ActiveDoc work (intervals) is now started when a doc finishes
  loading rather than in the constructor. The difference only showed up in
  tests which makes the intervals much shorter.

- Move timeoutReached() utility function to gutil, and use it for
  isLongerThan(), since they are basically identical. Also makes sure that the
  timer in these is cleared in all cases.

- Remove duplicate waitForIt implementation (previously had a copy in both
  test/server and core/test/server).

- Change testUtil.captureLog to pass messages to its callback, to allow asserts
  on messages within the callback.

Test Plan:
Added new unittests for the new shutdowns, including a replication
of a bad state that was possible during shutdown.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4040
2023-09-26 15:32:49 -04:00
..
client (core) Support dark mode in custom widgets 2023-09-19 16:08:21 -04:00
client-harness (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
common (core) Add timeouts to prevent ActiveDoc bad state during shutdown. 2023-09-26 15:32:49 -04:00
deployment Adding new lines at the end 2022-09-30 17:00:38 +02:00
fixtures (core) Support dark mode in custom widgets 2023-09-19 16:08:21 -04:00
formula-dataset (core) updates from grist-core 2023-08-21 09:15:53 -04:00
gen-server remove a log message about fetching URLs (#643) 2023-08-29 08:49:25 -04:00
nbrowser (core) Clearing widget repo state after tests. 2023-09-26 11:32:46 +02:00
server (core) Add timeouts to prevent ActiveDoc bad state during shutdown. 2023-09-26 15:32:49 -04:00
timings run grist-core test batches in parallel (#444) 2023-03-03 09:53:33 -05:00
.eslintrc.js Fixing all eslint's reported error 2023-01-03 17:22:58 +01:00
chai-as-promised.js (core) Faster builds all around. 2022-07-04 10:42:40 -04:00
declarations.d.ts (core) move LinkingError and RawData tests 2023-08-09 09:46:36 -04:00
init-mocha-webdriver.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
mocha.opts run grist-core test batches in parallel (#444) 2023-03-03 09:53:33 -05:00
report-why-tests-hang.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
setupPaths.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
split-tests.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
test_under_docker.sh move getTemplateOrg method; enable template org in docker tests (#602) 2023-07-31 16:10:59 -04:00
testUtils.ts (core) add missing tsconfig file that affects IDEs 2022-05-27 13:48:58 -04:00
tsconfig.json (core) Faster builds all around. 2022-07-04 10:42:40 -04:00
upgradeDocument add test/upgradeDocument utility 2023-01-17 16:14:15 -05:00
upgradeDocumentImpl.ts add test/upgradeDocument utility 2023-01-17 16:14:15 -05:00
utils.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
xunit-file.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00