xk6-frostfs/examples/s3.js
Alejandro Lopez 7bb16cdd94 [#49] Import and use k6-utils library for uuidv4
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
2023-04-13 16:31:54 +03:00

33 lines
760 B
JavaScript

import s3 from 'k6/x/frostfs/s3';
import { fail } from 'k6'
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
const payload = open('../go.sum', 'b');
const bucket = "cats"
const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true'})
export const options = {
stages: [
{duration: '30s', target: 10},
],
};
export function setup() {
const params = {
acl: 'private',
lock_enabled: 'true',
location_constraint: 'ru'
}
const res = s3_cli.createBucket(bucket, params)
if (!res.success) {
fail(res.error)
}
}
export default function () {
const key = uuidv4();
if (s3_cli.put(bucket, key, payload).success) {
s3_cli.get(bucket, key)
}
}