| 159 | }); |
| 160 | |
| 161 | async function assertRepartition(closePromise) { |
| 162 | const { code, signal, repartition } = await closePromise; |
| 163 | console.log('Test Details', { |
| 164 | KMS_NODES, |
| 165 | TOTAL_OBJECTS, |
| 166 | TOTAL_OBJECTS_PER_NODE, |
| 167 | APPROX, |
| 168 | EXPECTED_MIN, |
| 169 | EXPECTED_MAX, |
| 170 | code, |
| 171 | signal, |
| 172 | stderr, |
| 173 | repartition, |
| 174 | }); |
| 175 | const repartitionCount = repartition.map(({ count }) => count); |
| 176 | assert.strictEqual(code, 0, `tcpdump script closed with code ${code} and signal ${signal}`); |
| 177 | assert(repartition.length === KMS_NODES, `Expected ${KMS_NODES} IPs but got ${repartition.length}`); |
| 178 | assert(repartitionCount.every(count => |
| 179 | count >= EXPECTED_MIN && count <= EXPECTED_MAX), |
| 180 | `Repartition counts should be around ${TOTAL_OBJECTS_PER_NODE} ` + |
| 181 | `(±${APPROX}, min: ${EXPECTED_MIN}, max: ${EXPECTED_MAX}) but got ${repartitionCount}`); |
| 182 | } |
| 183 | |
| 184 | it(`should encrypt ${TOTAL_OBJECTS} times in parallel, ~${TOTAL_OBJECTS_PER_NODE} per node`, async () => { |
| 185 | await (Promise.all( |