xk6-frostfs/examples/native.js
Dmitrii Stepanov e92ce668a8 [#145] scenarios: Format js files with clang
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-06-14 11:26:01 +03:00

40 lines
1.1 KiB
JavaScript

import native from 'k6/x/frostfs/native';
import { fail } from "k6";
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
const payload = open('../go.sum', 'b');
const frostfs_cli = native.connect("s01.frostfs.devenv:8080", "1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb", 0, 0, false, 0)
export const options = {
stages: [
{ duration: '30s', target: 10 },
],
};
export function setup() {
const params = {
acl: 'public-read-write',
placement_policy: 'REP 3',
name: 'container-name',
name_global_scope: 'false'
}
const res = frostfs_cli.putContainer(params)
if (!res.success) {
fail(res.error)
}
console.info("created container", res.container_id)
return { container_id: res.container_id }
}
export default function (data) {
let headers = {
'unique_header': uuidv4()
}
let resp = frostfs_cli.put(data.container_id, headers, payload)
if (resp.success) {
frostfs_cli.get(data.container_id, resp.object_id)
} else {
console.log(resp.error)
}
}