mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add options to /status health-check endpoints to check DB and Redis liveness.
Summary: - /status accepts new optional query parameters: db=1, redis=1, and timeout=<ms> (defaults to 10_000). - These verify that the server can make trivial calls to DB/Redis, and that they return within the timeout. - New HealthCheck tests simulates DB and Redis problems. - Added resilience to Redis reconnects (helped by a test case that simulates disconnects) - When closing Redis-based session store, disconnect from Redis (to avoid hanging tests) Some associated test reorg: - Move stripeTools out of test/nbrowser, and remove an unnecessary dependency, to avoid starting up browser for gen-server tests. - Move TcpForwarder to its own file, to use in the new test. Test Plan: Added a new HealthCheck test that simulates DB and Redis problems. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4054
This commit is contained in:
@@ -51,9 +51,11 @@ export class TestServer {
|
||||
// TypeORM doesn't give us a very clean way to shut down the db connection,
|
||||
// and node-sqlite3 has become fussier about this, and in regular tests
|
||||
// we substitute sqlite for postgres.
|
||||
for (let i = 0; i < 30; i++) {
|
||||
if (!this.server.getNotifier().testPending) { break; }
|
||||
await delay(100);
|
||||
if (this.server.hasNotifier()) {
|
||||
for (let i = 0; i < 30; i++) {
|
||||
if (!this.server.getNotifier().testPending) { break; }
|
||||
await delay(100);
|
||||
}
|
||||
}
|
||||
await removeConnection();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user