xk6-frostfs/scenarios/libs/keygen.js
Dmitrii Stepanov e0cbc3b763
All checks were successful
DCO action / DCO (pull_request) Successful in 1m5s
Tests and linters / Tests (pull_request) Successful in 1m45s
Tests and linters / Lint (pull_request) Successful in 2m50s
Tests and linters / Tests with -race (pull_request) Successful in 2m46s
[#124] s3: Allow to specify directory height and width
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-10-25 12:20:15 +03:00

17 lines
No EOL
458 B
JavaScript

import {uuidv4} from './k6-utils-1.4.0.js';
export function generateS3Key() {
let width = parseInt(__ENV.DIR_WIDTH || '0');
let height = parseInt(__ENV.DIR_HEIGHT || '0');
let key = ''
if (width > 0 && height > 0) {
for (let index = 0; index < height; index++) {
const w = Math.floor(Math.random() * width) + 1;
key = key + 'dir' + w + '/';
}
}
key += (__ENV.OBJ_NAME || uuidv4());
return key;
}