@@ -124,9 +124,9 @@ describe(`KMS load (kmip cluster ${KMS_NODES} nodes): ${OBJECT_NUMBER
124124 } ) ;
125125
126126 beforeEach ( async ( ) => {
127- // tcpdump can catch more than TOTAL_OBJECTS packets because there are PSH and ACK packets
128- // but we need to ensure it actually stops before there is no more packets
129- // to count packets by IP
127+ // tcpdump captures exactly TOTAL_OBJECTS PSH packets then exits naturally,
128+ // allowing the pipeline to drain and output results.
129+ // Consider sending a little more request in case a packet is missed.
130130 tcpdumpProcess = await spawnTcpdump ( 5696 , TOTAL_OBJECTS ) ;
131131 stdout = '' ;
132132 stderr = '' ;
@@ -185,7 +185,8 @@ describe(`KMS load (kmip cluster ${KMS_NODES} nodes): ${OBJECT_NUMBER
185185 it ( `should encrypt ${ TOTAL_OBJECTS } times in parallel, ~${ TOTAL_OBJECTS_PER_NODE } per node` , async ( ) => {
186186 await ( Promise . all (
187187 buckets . map ( async ( { Bucket } ) => Promise . all (
188- new Array ( OBJECT_NUMBER ) . fill ( 0 ) . map ( async ( _ , i ) =>
188+ // Send little more request in case a packet is missed.
189+ new Array ( OBJECT_NUMBER + 1 ) . fill ( 0 ) . map ( async ( _ , i ) =>
189190 helpers . s3 . putObject ( { Bucket, Key : `obj-${ i } ` , Body : `body-${ i } ` } ) . promise ( ) )
190191 ) )
191192 ) ) ;
@@ -195,7 +196,8 @@ describe(`KMS load (kmip cluster ${KMS_NODES} nodes): ${OBJECT_NUMBER
195196 it ( `should decrypt ${ TOTAL_OBJECTS } times in parallel, ~${ TOTAL_OBJECTS_PER_NODE } per node` , async ( ) => {
196197 await Promise . all (
197198 buckets . map ( async ( { Bucket } ) => Promise . all (
198- new Array ( OBJECT_NUMBER ) . fill ( 0 ) . map ( async ( _ , i ) =>
199+ // Send little more request in case a packet is missed.
200+ new Array ( OBJECT_NUMBER + 1 ) . fill ( 0 ) . map ( async ( _ , i ) =>
199201 helpers . s3 . getObject ( { Bucket, Key : `obj-${ i } ` } ) . promise ( ) )
200202 ) )
201203 ) ;
0 commit comments