Rename flag and make tests work

pull/767/head
Florent FAYOLLE 4 months ago committed by fflorent
parent 0aab6d6349
commit fe2d5e8c7e

@ -234,9 +234,9 @@ export class ChecksummedExternalStorage implements ExternalStorage {
const message = `ext ${this.label} download: data for ${fromKey} has wrong checksum:` +
` ${checksum} (expected ${expectedChecksum})`;
// Only warn if GRIST_DISCARD_REDIS_CHECKSUM_MISMATCH is set. This flag is experimental
// Only warn if GRIST_SKIP_REDIS_CHECKSUM_MISMATCH is set. This flag is experimental
// and should be removed once we are confident that the checksums verification is useless.
if (isAffirmative(process.env.GRIST_DISCARD_REDIS_CHECKSUM_MISMATCH)) {
if (isAffirmative(process.env.GRIST_SKIP_REDIS_CHECKSUM_MISMATCH)) {
log.warn(message);
} else {
log.error(message);

@ -439,6 +439,7 @@ describe('HostedStorageManager', function() {
});
afterEach(async function() {
delete process.env.GRIST_SKIP_REDIS_CHECKSUM_MISMATCH;
sandbox.restore();
if (store) {
await store.end();
@ -475,9 +476,18 @@ describe('HostedStorageManager', function() {
assert.notEqual(checksum, 'null');
await store.end();
// Check if we nobble the expected checksum then fetch eventually errors.
// Check what happens when we nobble the expected checksum.
await setRedisChecksum(docId, 'nobble');
await store.removeAll();
// With GRIST_SKIP_REDIS_CHECKSUM_MISMATCH set, the fetch should work
process.env.GRIST_SKIP_REDIS_CHECKSUM_MISMATCH = 'true';
await store.begin();
await assert.isFulfilled(store.docManager.fetchDoc(docSession, docId));
await store.end();
// By default, the fetch should eventually errors.
delete process.env.GRIST_SKIP_REDIS_CHECKSUM_MISMATCH;
await store.begin();
await assert.isRejected(store.docManager.fetchDoc(docSession, docId),
/operation failed to become consistent/);

Loading…
Cancel
Save