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