Skip to content

Commit d396d9c

Browse files
committed
Test with actual big numbers
Issue: S3UTILS-188
1 parent d658a6c commit d396d9c

File tree

1 file changed

+239
-0
lines changed

1 file changed

+239
-0
lines changed

tests/unit/CountItems/CountManager.js

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,245 @@ describe('CountItems::CountManager', () => {
550550
});
551551
});
552552

553+
test('should update dataMetrics with large numbers above MAX_SAFE_INTEGER for both counts and capacity', () => {
554+
const workers = createWorkers(1);
555+
const m = new CountManager({
556+
log: new DummyLogger(),
557+
workers,
558+
maxConcurrent: 1,
559+
});
560+
m._consolidateData({
561+
dataMetrics: {
562+
account: {
563+
account1: {
564+
objectCount: {
565+
current: 9007199254740991n,
566+
deleteMarker: 9007199254740991n,
567+
nonCurrent: 9007199254740991n,
568+
_currentCold: 9007199254740991n,
569+
_nonCurrentCold: 9007199254740991n,
570+
_currentRestored: 9007199254740991n,
571+
_currentRestoring: 9007199254740991n,
572+
_nonCurrentRestored: 9007199254740991n,
573+
_nonCurrentRestoring: 9007199254740991n,
574+
_incompleteMPUUploads: 9007199254740991n,
575+
},
576+
usedCapacity: {
577+
current: 9007199254740991n,
578+
nonCurrent: 9007199254740992n,
579+
_currentCold: 9007199254740991n,
580+
_nonCurrentCold: 9007199254740991n,
581+
_currentRestored: 9007199254740991n,
582+
_currentRestoring: 9007199254740991n,
583+
_nonCurrentRestored: 9007199254740991n,
584+
_nonCurrentRestoring: 9007199254740991n,
585+
_incompleteMPUParts: 9007199254740991n,
586+
_inflightsPreScan: 9007199254740991n,
587+
},
588+
locations: {
589+
location1: {
590+
objectCount: {
591+
current: 9007199254740991n,
592+
deleteMarker: 9007199254740991n,
593+
nonCurrent: 9007199254740991n,
594+
_currentCold: 9007199254740991n,
595+
_nonCurrentCold: 9007199254740991n,
596+
_currentRestored: 9007199254740991n,
597+
_currentRestoring: 9007199254740991n,
598+
_nonCurrentRestored: 9007199254740991n,
599+
_nonCurrentRestoring: 9007199254740991n,
600+
_incompleteMPUUploads: 9007199254740991n,
601+
},
602+
usedCapacity: {
603+
current: 9007199254740991n,
604+
nonCurrent: 9007199254740992n,
605+
_currentCold: 9007199254740991n,
606+
_nonCurrentCold: 9007199254740991n,
607+
_currentRestored: 9007199254740991n,
608+
_currentRestoring: 9007199254740991n,
609+
_nonCurrentRestored: 9007199254740991n,
610+
_nonCurrentRestoring: 9007199254740991n,
611+
_incompleteMPUParts: 9007199254740991n,
612+
_inflightsPreScan: 9007199254740991n,
613+
},
614+
},
615+
},
616+
},
617+
},
618+
bucket: {
619+
bucket1: {
620+
objectCount: {
621+
current: 9007199254740991n,
622+
deleteMarker: 9007199254740991n,
623+
nonCurrent: 9007199254740991n,
624+
_currentCold: 9007199254740991n,
625+
_nonCurrentCold: 9007199254740991n,
626+
_currentRestored: 9007199254740991n,
627+
_currentRestoring: 9007199254740991n,
628+
_nonCurrentRestored: 9007199254740991n,
629+
_nonCurrentRestoring: 9007199254740991n,
630+
_incompleteMPUUploads: 9007199254740991n,
631+
},
632+
usedCapacity: {
633+
current: 9007199254740991n,
634+
nonCurrent: 9007199254740992n,
635+
_currentCold: 9007199254740991n,
636+
_nonCurrentCold: 9007199254740991n,
637+
_currentRestored: 9007199254740991n,
638+
_currentRestoring: 9007199254740991n,
639+
_nonCurrentRestored: 9007199254740991n,
640+
_nonCurrentRestoring: 9007199254740991n,
641+
_incompleteMPUParts: 9007199254740991n,
642+
_inflightsPreScan: 9007199254740991n,
643+
},
644+
},
645+
},
646+
location: {
647+
location1: {
648+
objectCount: {
649+
current: 9007199254740991n,
650+
deleteMarker: 9007199254740991n,
651+
nonCurrent: 9007199254740991n,
652+
_currentCold: 9007199254740991n,
653+
_nonCurrentCold: 9007199254740991n,
654+
_currentRestored: 9007199254740991n,
655+
_currentRestoring: 9007199254740991n,
656+
_nonCurrentRestored: 9007199254740991n,
657+
_nonCurrentRestoring: 9007199254740991n,
658+
_incompleteMPUUploads: 9007199254740991n,
659+
},
660+
usedCapacity: {
661+
current: 9007199254740991n,
662+
nonCurrent: 9007199254740992n,
663+
_currentCold: 9007199254740991n,
664+
_nonCurrentCold: 9007199254740991n,
665+
_currentRestored: 9007199254740991n,
666+
_currentRestoring: 9007199254740991n,
667+
_nonCurrentRestored: 9007199254740991n,
668+
_nonCurrentRestoring: 9007199254740991n,
669+
_incompleteMPUParts: 9007199254740991n,
670+
_inflightsPreScan: 9007199254740991n,
671+
},
672+
},
673+
},
674+
},
675+
});
676+
expect(m.dataMetrics).toEqual({
677+
account: {
678+
account1: {
679+
objectCount: {
680+
current: 45035996273704955n,
681+
deleteMarker: 9007199254740991n,
682+
nonCurrent: 36028797018963964n,
683+
_currentCold: 9007199254740991n,
684+
_nonCurrentCold: 9007199254740991n,
685+
_currentRestored: 9007199254740991n,
686+
_currentRestoring: 9007199254740991n,
687+
_nonCurrentRestored: 9007199254740991n,
688+
_nonCurrentRestoring: 9007199254740991n,
689+
_incompleteMPUUploads: 9007199254740991n,
690+
},
691+
usedCapacity: {
692+
current: 45035996273704955n,
693+
nonCurrent: 36028797018963965n,
694+
_currentCold: 9007199254740991n,
695+
_nonCurrentCold: 9007199254740991n,
696+
_currentRestored: 9007199254740991n,
697+
_currentRestoring: 9007199254740991n,
698+
_nonCurrentRestored: 9007199254740991n,
699+
_nonCurrentRestoring: 9007199254740991n,
700+
_incompleteMPUParts: 9007199254740991n,
701+
_inflightsPreScan: 9007199254740991n,
702+
},
703+
locations: {
704+
location1: {
705+
objectCount: {
706+
current: 45035996273704955n,
707+
deleteMarker: 9007199254740991n,
708+
nonCurrent: 36028797018963964n,
709+
_currentCold: 9007199254740991n,
710+
_nonCurrentCold: 9007199254740991n,
711+
_currentRestored: 9007199254740991n,
712+
_currentRestoring: 9007199254740991n,
713+
_nonCurrentRestored: 9007199254740991n,
714+
_nonCurrentRestoring: 9007199254740991n,
715+
_incompleteMPUUploads: 9007199254740991n,
716+
},
717+
usedCapacity: {
718+
current: 45035996273704955n,
719+
nonCurrent: 36028797018963965n,
720+
_currentCold: 9007199254740991n,
721+
_nonCurrentCold: 9007199254740991n,
722+
_currentRestored: 9007199254740991n,
723+
_currentRestoring: 9007199254740991n,
724+
_nonCurrentRestored: 9007199254740991n,
725+
_nonCurrentRestoring: 9007199254740991n,
726+
_incompleteMPUParts: 9007199254740991n,
727+
_inflightsPreScan: 9007199254740991n,
728+
},
729+
},
730+
},
731+
},
732+
},
733+
bucket: {
734+
bucket1: {
735+
objectCount: {
736+
current: 45035996273704955n,
737+
deleteMarker: 9007199254740991n,
738+
nonCurrent: 36028797018963964n,
739+
_currentCold: 9007199254740991n,
740+
_nonCurrentCold: 9007199254740991n,
741+
_currentRestored: 9007199254740991n,
742+
_currentRestoring: 9007199254740991n,
743+
_nonCurrentRestored: 9007199254740991n,
744+
_nonCurrentRestoring: 9007199254740991n,
745+
_incompleteMPUUploads: 9007199254740991n,
746+
},
747+
usedCapacity: {
748+
current: 45035996273704955n,
749+
nonCurrent: 36028797018963965n,
750+
_currentCold: 9007199254740991n,
751+
_nonCurrentCold: 9007199254740991n,
752+
_currentRestored: 9007199254740991n,
753+
_currentRestoring: 9007199254740991n,
754+
_nonCurrentRestored: 9007199254740991n,
755+
_nonCurrentRestoring: 9007199254740991n,
756+
_incompleteMPUParts: 9007199254740991n,
757+
_inflightsPreScan: 9007199254740991n,
758+
},
759+
},
760+
},
761+
location: {
762+
location1: {
763+
objectCount: {
764+
current: 45035996273704955n,
765+
deleteMarker: 9007199254740991n,
766+
nonCurrent: 36028797018963964n,
767+
_currentCold: 9007199254740991n,
768+
_nonCurrentCold: 9007199254740991n,
769+
_currentRestored: 9007199254740991n,
770+
_currentRestoring: 9007199254740991n,
771+
_nonCurrentRestored: 9007199254740991n,
772+
_nonCurrentRestoring: 9007199254740991n,
773+
_incompleteMPUUploads: 9007199254740991n,
774+
},
775+
usedCapacity: {
776+
current: 45035996273704955n,
777+
nonCurrent: 36028797018963965n,
778+
_currentCold: 9007199254740991n,
779+
_nonCurrentCold: 9007199254740991n,
780+
_currentRestored: 9007199254740991n,
781+
_currentRestoring: 9007199254740991n,
782+
_nonCurrentRestored: 9007199254740991n,
783+
_nonCurrentRestoring: 9007199254740991n,
784+
_incompleteMPUParts: 9007199254740991n,
785+
_inflightsPreScan: 9007199254740991n,
786+
},
787+
},
788+
},
789+
});
790+
});
791+
553792
test('should add tasks to queue', () => {
554793
const workers = createWorkers(1);
555794
const m = new CountManager({

0 commit comments

Comments
 (0)