diff --git a/lib/queuePopulator/LogReader.js b/lib/queuePopulator/LogReader.js index 4eab191a7d..4189cdfea2 100644 --- a/lib/queuePopulator/LogReader.js +++ b/lib/queuePopulator/LogReader.js @@ -499,6 +499,7 @@ class LogReader { const overheadFields = { commitTimestamp: record.timestamp, opTimestamp: entry.timestamp, + versionId: entry.overhead?.versionId, }; const entryToFilter = { type: entry.type, diff --git a/tests/unit/lib/queuePopulator/LogReader.spec.js b/tests/unit/lib/queuePopulator/LogReader.spec.js index 511b80c435..efd90b62fa 100644 --- a/tests/unit/lib/queuePopulator/LogReader.spec.js +++ b/tests/unit/lib/queuePopulator/LogReader.spec.js @@ -110,6 +110,7 @@ describe('LogReader', () => { overheadFields: { commitTimestamp: record.timestamp, opTimestamp: '2023-11-29T15:05:57.065Z', + versionId: undefined, }, }; assert(mockExtension.filter.firstCall.calledWith(expectedArgs)); @@ -155,6 +156,7 @@ describe('LogReader', () => { overheadFields: { commitTimestamp: record.timestamp, opTimestamp: '2023-11-29T15:05:57.065Z', + versionId: undefined, }, }; assert(mockExtension.filter.firstCall.calledWith(expectedArgs)); @@ -244,4 +246,54 @@ describe('LogReader', () => { }); }); }); + + describe('_processLogEntry', () => { + [ + { + description: 'with overhead fields', + overhead: null, + }, { + description: 'without overhead fields', + overhead: { + versionId: '1234', + }, + } + ].forEach(params => { + it(`should pass the proper fields to the filter method (${params.description})`, done => { + const date = Date.now(); + const record = { + db: 'example-bucket', + timestamp: date, + }; + const entry = { + type: 'put', + key: 'example-key', + timestamp: date, + value: null, + overhead: params.overhead, + }; + logReader._extensions = [ + { + filter: sinon.stub().returns(), + }, + ]; + logReader._processLogEntry({}, record, entry, err => { + assert.ifError(err); + assert(logReader._extensions[0].filter.calledWithMatch({ + type: 'put', + bucket: 'example-bucket', + key: 'example-key', + value: null, + logReader, + overheadFields: { + commitTimestamp: date, + opTimestamp: date, + ...params.overhead, + }, + })); + done(); + }); + }); + }); + }); });