mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
* Shutdown Doc worker when it is not considered as available in Redis * Use isAffirmative for GRIST_MANAGED_WORKERS * Upgrade Sinon for the tests * Run Smoke test with pages in English * Add logic in /status endpoint
This commit is contained in:
@@ -402,20 +402,19 @@ describe('Comm', function() {
|
||||
|
||||
// Intercept the call to _onClose to know when it occurs, since we are trying to hit a
|
||||
// situation where 'close' and 'failedSend' events happen in either order.
|
||||
const stubOnClose = sandbox.stub(Client.prototype as any, '_onClose')
|
||||
.callsFake(async function(this: Client) {
|
||||
if (!options.closeHappensFirst) { await delay(10); }
|
||||
const stubOnClose: any = sandbox.stub(Client.prototype as any, '_onClose')
|
||||
.callsFake(function(this: Client) {
|
||||
eventsSeen.push('close');
|
||||
return (stubOnClose as any).wrappedMethod.apply(this, arguments);
|
||||
return stubOnClose.wrappedMethod.apply(this, arguments);
|
||||
});
|
||||
|
||||
// Intercept calls to client.sendMessage(), to know when it fails, and possibly to delay the
|
||||
// failures to hit a particular order in which 'close' and 'failedSend' events are seen by
|
||||
// Client.ts. This is the only reliable way I found to reproduce this order of events.
|
||||
const stubSendToWebsocket = sandbox.stub(Client.prototype as any, '_sendToWebsocket')
|
||||
const stubSendToWebsocket: any = sandbox.stub(Client.prototype as any, '_sendToWebsocket')
|
||||
.callsFake(async function(this: Client) {
|
||||
try {
|
||||
return await (stubSendToWebsocket as any).wrappedMethod.apply(this, arguments);
|
||||
return await stubSendToWebsocket.wrappedMethod.apply(this, arguments);
|
||||
} catch (err) {
|
||||
if (options.closeHappensFirst) { await delay(100); }
|
||||
eventsSeen.push('failedSend');
|
||||
|
||||
@@ -48,7 +48,7 @@ describe("MinIOExternalStorage", function () {
|
||||
|
||||
s3.listObjects.returns(fakeStream);
|
||||
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3 as any);
|
||||
const result = await extStorage.versions(key);
|
||||
|
||||
assert.deepEqual(result, []);
|
||||
@@ -74,7 +74,7 @@ describe("MinIOExternalStorage", function () {
|
||||
]);
|
||||
|
||||
s3.listObjects.returns(fakeStream);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3 as any);
|
||||
// when
|
||||
const result = await extStorage.versions(key);
|
||||
// then
|
||||
@@ -107,7 +107,7 @@ describe("MinIOExternalStorage", function () {
|
||||
let {fakeStream} = makeFakeStream(objectsFromS3);
|
||||
|
||||
s3.listObjects.returns(fakeStream);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3 as any);
|
||||
|
||||
// when
|
||||
const result = await extStorage.versions(key);
|
||||
@@ -142,10 +142,10 @@ describe("MinIOExternalStorage", function () {
|
||||
const fakeStream = new stream.Readable({objectMode: true});
|
||||
const error = new Error("dummy-error");
|
||||
sandbox.stub(fakeStream, "_read")
|
||||
.returns(fakeStream)
|
||||
.returns(fakeStream as any)
|
||||
.callsFake(() => fakeStream.emit('error', error));
|
||||
s3.listObjects.returns(fakeStream);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3);
|
||||
const extStorage = new MinIOExternalStorage(dummyBucket, dummyOptions, 42, s3 as any);
|
||||
|
||||
// when
|
||||
const result = extStorage.versions(key);
|
||||
@@ -154,4 +154,4 @@ describe("MinIOExternalStorage", function () {
|
||||
return assert.isRejected(result, error);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user