xk6-frostfs/examples/s3.js
Alexander Chuprov 6adc201c2c
All checks were successful
DCO action / DCO (pull_request) Successful in 1m15s
Tests and linters / Check clang-format (pull_request) Successful in 1m25s
Tests and linters / Tests (pull_request) Successful in 1m46s
Tests and linters / Tests with -race (pull_request) Successful in 2m22s
Tests and linters / Lint (pull_request) Successful in 3m9s
[#164] *.js: Fix formatting
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2024-11-06 16:32:50 +03:00

35 lines
723 B
JavaScript

import {fail} from 'k6'
import s3 from 'k6/x/frostfs/s3';
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)
}
}