Skip to content

Commit

Permalink
Test with actual big numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed Jan 24, 2025
1 parent 15c4b46 commit a8b1892
Showing 1 changed file with 239 additions and 0 deletions.
239 changes: 239 additions & 0 deletions tests/unit/CountItems/CountManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,245 @@ describe('CountItems::CountManager', () => {
});
});

test('should update dataMetrics with large numbers above MAX_SAFE_INTEGER for both counts and capacity', () => {
const workers = createWorkers(1);
const m = new CountManager({
log: new DummyLogger(),
workers,
maxConcurrent: 1,
});
m._consolidateData({
dataMetrics: {
account: {
account1: {
objectCount: {
current: 9007199254740991n,
deleteMarker: 9007199254740991n,
nonCurrent: 9007199254740991n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 9007199254740991n,
nonCurrent: 9007199254740992n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
locations: {
location1: {
objectCount: {
current: 9007199254740991n,
deleteMarker: 9007199254740991n,
nonCurrent: 9007199254740991n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 9007199254740991n,
nonCurrent: 9007199254740992n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
},
},
bucket: {
bucket1: {
objectCount: {
current: 9007199254740991n,
deleteMarker: 9007199254740991n,
nonCurrent: 9007199254740991n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 9007199254740991n,
nonCurrent: 9007199254740992n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
location: {
location1: {
objectCount: {
current: 9007199254740991n,
deleteMarker: 9007199254740991n,
nonCurrent: 9007199254740991n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 9007199254740991n,
nonCurrent: 9007199254740992n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
},
});
expect(m.dataMetrics).toEqual({
account: {
account1: {
objectCount: {
current: 45035996273704955n,
deleteMarker: 9007199254740991n,
nonCurrent: 36028797018963964n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 45035996273704955n,
nonCurrent: 36028797018963965n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
locations: {
location1: {
objectCount: {
current: 45035996273704955n,
deleteMarker: 9007199254740991n,
nonCurrent: 36028797018963964n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 45035996273704955n,
nonCurrent: 36028797018963965n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
},
},
bucket: {
bucket1: {
objectCount: {
current: 45035996273704955n,
deleteMarker: 9007199254740991n,
nonCurrent: 36028797018963964n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 45035996273704955n,
nonCurrent: 36028797018963965n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
location: {
location1: {
objectCount: {
current: 45035996273704955n,
deleteMarker: 9007199254740991n,
nonCurrent: 36028797018963964n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUUploads: 9007199254740991n,
},
usedCapacity: {
current: 45035996273704955n,
nonCurrent: 36028797018963965n,
_currentCold: 9007199254740991n,
_nonCurrentCold: 9007199254740991n,
_currentRestored: 9007199254740991n,
_currentRestoring: 9007199254740991n,
_nonCurrentRestored: 9007199254740991n,
_nonCurrentRestoring: 9007199254740991n,
_incompleteMPUParts: 9007199254740991n,
_inflightsPreScan: 9007199254740991n,
},
},
},
});
});

test('should add tasks to queue', () => {
const workers = createWorkers(1);
const m = new CountManager({
Expand Down

0 comments on commit a8b1892

Please sign in to comment.