Compare commits
4 commits
master
...
feat/add_c
Author | SHA1 | Date | |
---|---|---|---|
978e1b891e | |||
4e13198159 | |||
fad5d9b16c | |||
fe90707913 |
22 changed files with 640 additions and 545 deletions
|
@ -20,6 +20,27 @@ jobs:
|
||||||
- name: Run linters
|
- name: Run linters
|
||||||
run: make lint
|
run: make lint
|
||||||
|
|
||||||
|
check-format:
|
||||||
|
name: Check format
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt install -y clang-format
|
||||||
|
|
||||||
|
- name: Run clang-format
|
||||||
|
run: clang-format -i **/*.js
|
||||||
|
|
||||||
|
- name: Print diff
|
||||||
|
run: git diff HEAD
|
||||||
|
|
||||||
|
- name: Check that nothing has changed
|
||||||
|
run: git diff-index --exit-code HEAD
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
55
.pre-commit-config.yaml
Normal file
55
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
ci:
|
||||||
|
autofix_prs: false
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.5.0
|
||||||
|
hooks:
|
||||||
|
- id: check-added-large-files
|
||||||
|
- id: check-case-conflict
|
||||||
|
- id: check-executables-have-shebangs
|
||||||
|
- id: check-shebang-scripts-are-executable
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: check-json
|
||||||
|
- id: check-xml
|
||||||
|
- id: check-yaml
|
||||||
|
- id: trailing-whitespace
|
||||||
|
args: [--markdown-linebreak-ext=md]
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
exclude: "(.key|.svg)$"
|
||||||
|
|
||||||
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||||
|
rev: v0.9.0.6
|
||||||
|
hooks:
|
||||||
|
- id: shellcheck
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: make-lint
|
||||||
|
name: Run Make Lint
|
||||||
|
entry: make lint
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: make-format
|
||||||
|
name: Run Make format
|
||||||
|
entry: make format
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: go-unit-tests
|
||||||
|
name: go unit tests
|
||||||
|
entry: make test GOFLAGS=''
|
||||||
|
pass_filenames: false
|
||||||
|
types: [go]
|
||||||
|
language: system
|
||||||
|
|
||||||
|
- repo: https://github.com/TekWizely/pre-commit-golang
|
||||||
|
rev: v1.0.0-rc.1
|
||||||
|
hooks:
|
||||||
|
- id: go-staticcheck-repo-mod
|
||||||
|
- id: go-mod-tidy
|
9
Makefile
9
Makefile
|
@ -62,10 +62,19 @@ cover:
|
||||||
@go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic
|
@go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic
|
||||||
@go tool cover -html=coverage.txt -o coverage.html
|
@go tool cover -html=coverage.txt -o coverage.html
|
||||||
|
|
||||||
|
# Install gofumpt
|
||||||
|
fumpt-install:
|
||||||
|
@echo "⇒ Processing fumpt install"
|
||||||
|
@rm -rf $(GOFUMPT_DIR)
|
||||||
|
@mkdir $(GOFUMPT_DIR)
|
||||||
|
@GOBIN=$(GOFUMPT_VERSION_DIR) go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION)
|
||||||
|
|
||||||
# Reformat code
|
# Reformat code
|
||||||
format:
|
format:
|
||||||
@echo "⇒ Processing gofmt check"
|
@echo "⇒ Processing gofmt check"
|
||||||
@gofmt -s -w ./
|
@gofmt -s -w ./
|
||||||
|
@echo "⇒ Processing clang format"
|
||||||
|
@clang-format -i **/*.js
|
||||||
|
|
||||||
# Run linters
|
# Run linters
|
||||||
lint:
|
lint:
|
||||||
|
|
|
@ -57,7 +57,7 @@ const frostfs_cli = native.connect("s01.frostfs.devenv:8080", "", 0, 0, false, 0
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
- `putContainer(params)`. The `params` is a dictionary (e.g.
|
- `putContainer(params)`. The `params` is a dictionary (e.g.
|
||||||
`{placement_policy:'REP 3',name:'container-name',name_global_scope:'false'}`).
|
`{acl:'public-read-write',placement_policy:'REP 3',name:'container-name',name_global_scope:'false'}`).
|
||||||
Returns dictionary with `success`
|
Returns dictionary with `success`
|
||||||
boolean flag, `container_id` string, and `error` string.
|
boolean flag, `container_id` string, and `error` string.
|
||||||
- `setBufferSize(size)`. Sets internal buffer size for data upload and
|
- `setBufferSize(size)`. Sets internal buffer size for data upload and
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
import local from 'k6/x/frostfs/local';
|
import local from 'k6/x/frostfs/local';
|
||||||
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
|
|
||||||
|
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
const payload = open('../go.sum', 'b');
|
const payload = open('../go.sum', 'b');
|
||||||
const local_cli = local.connect("/path/to/config.yaml", "/path/to/config/dir", "", false)
|
const local_cli =
|
||||||
|
local.connect("/path/to/config.yaml", "/path/to/config/dir", "", false)
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
stages: [
|
stages : [
|
||||||
{duration: '30s', target: 10},
|
{duration : '30s', target : 10},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
let headers = {
|
let headers = {
|
||||||
'unique_header': uuidv4()
|
'unique_header' : uuidv4()
|
||||||
}
|
}
|
||||||
|
|
||||||
const container_id = '6BVPPXQewRJ6J5EYmAPLczXxNocS7ikyF7amS2esWQnb';
|
const container_id = '6BVPPXQewRJ6J5EYmAPLczXxNocS7ikyF7amS2esWQnb';
|
||||||
let resp = local_cli.put(container_id, headers, payload)
|
let resp = local_cli.put(container_id, headers, payload)
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
local_cli.get(container_id, resp.object_id)
|
local_cli.get(container_id, resp.object_id)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
console.log(resp.error)
|
console.log(resp.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,26 @@
|
||||||
|
import {fail} from "k6";
|
||||||
import native from 'k6/x/frostfs/native';
|
import native from 'k6/x/frostfs/native';
|
||||||
import { fail } from "k6";
|
|
||||||
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
|
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
const payload = open('../go.sum', 'b');
|
const payload = open('../go.sum', 'b');
|
||||||
const frostfs_cli = native.connect("s01.frostfs.devenv:8080", "1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb", 0, 0, false, 0)
|
const frostfs_cli = native.connect(
|
||||||
|
"s01.frostfs.devenv:8080",
|
||||||
|
"1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb", 0, 0,
|
||||||
|
false, 0)
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
stages: [
|
stages : [
|
||||||
{ duration: '30s', target: 10 },
|
{duration : '30s', target : 10},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
const params = {
|
const params = {
|
||||||
placement_policy: 'REP 3',
|
acl : 'public-read-write',
|
||||||
name: 'container-name',
|
placement_policy : 'REP 3',
|
||||||
name_global_scope: 'false'
|
name : 'container-name',
|
||||||
|
name_global_scope : 'false'
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = frostfs_cli.putContainer(params)
|
const res = frostfs_cli.putContainer(params)
|
||||||
|
@ -26,14 +31,13 @@ export function setup() {
|
||||||
return { container_id: res.container_id }
|
return { container_id: res.container_id }
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (data) {
|
export default function(data) {
|
||||||
let headers = {
|
let headers = {'unique_header' : uuidv4()} let resp =
|
||||||
'unique_header': uuidv4()
|
frostfs_cli.put(data.container_id, headers, payload)
|
||||||
}
|
|
||||||
let resp = frostfs_cli.put(data.container_id, headers, payload)
|
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
frostfs_cli.get(data.container_id, resp.object_id)
|
frostfs_cli.get(data.container_id, resp.object_id)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
console.log(resp.error)
|
console.log(resp.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
import native from 'k6/x/frostfs/native';
|
import native from 'k6/x/frostfs/native';
|
||||||
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
|
|
||||||
|
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
const payload = open('../go.sum', 'b');
|
const payload = open('../go.sum', 'b');
|
||||||
const container = "AjSxSNNXbJUDPqqKYm1VbFVDGCakbpUNH8aGjPmGAH3B"
|
const container = "AjSxSNNXbJUDPqqKYm1VbFVDGCakbpUNH8aGjPmGAH3B"
|
||||||
const frostfs_cli = native.connect("s01.frostfs.devenv:8080", "", 0, 0, false, 0)
|
const frostfs_cli =
|
||||||
|
native.connect("s01.frostfs.devenv:8080", "", 0, 0, false, 0)
|
||||||
const frostfs_obj = frostfs_cli.onsite(container, payload)
|
const frostfs_obj = frostfs_cli.onsite(container, payload)
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
stages: [
|
stages : [
|
||||||
{ duration: '30s', target: 10 },
|
{duration : '30s', target : 10},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
let headers = {
|
let headers = {'unique_header' : uuidv4()}
|
||||||
'unique_header': uuidv4()
|
|
||||||
}
|
|
||||||
let resp = frostfs_obj.put(headers)
|
let resp = frostfs_obj.put(headers)
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
frostfs_cli.get(container, resp.object_id)
|
frostfs_cli.get(container, resp.object_id)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
console.log(resp.error)
|
console.log(resp.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
|
import {fail} from 'k6'
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import { fail } from 'k6'
|
|
||||||
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
|
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
const payload = open('../go.sum', 'b');
|
const payload = open('../go.sum', 'b');
|
||||||
const bucket = "cats"
|
const bucket = "cats"
|
||||||
const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true'})
|
const s3_cli =
|
||||||
|
s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl' : 'true'})
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
stages: [
|
stages : [
|
||||||
{duration: '30s', target: 10},
|
{duration : '30s', target : 10},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
const params = {
|
const params = {
|
||||||
acl: 'private',
|
acl : 'private',
|
||||||
lock_enabled: 'true',
|
lock_enabled : 'true',
|
||||||
location_constraint: 'ru'
|
location_constraint : 'ru'
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = s3_cli.createBucket(bucket, params)
|
const res = s3_cli.createBucket(bucket, params)
|
||||||
|
@ -25,7 +27,7 @@ export function setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
const key = uuidv4();
|
const key = uuidv4();
|
||||||
if (s3_cli.put(bucket, key, payload).success) {
|
if (s3_cli.put(bucket, key, payload).success) {
|
||||||
s3_cli.get(bucket, key)
|
s3_cli.get(bucket, key)
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import s3local from 'k6/x/frostfs/s3local';
|
import s3local from 'k6/x/frostfs/s3local';
|
||||||
import { uuidv4 } from '../scenarios/libs/k6-utils-1.4.0.js';
|
|
||||||
|
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
const bucket = "testbucket"
|
const bucket = "testbucket"
|
||||||
const payload = open('../go.sum', 'b');
|
const payload = open('../go.sum', 'b');
|
||||||
const s3local_cli = s3local.connect("path/to/storage/config.yml", "path/to/storage/config/dir", {}, {
|
const s3local_cli = s3local.connect(
|
||||||
'testbucket': 'GBQDDUM1hdodXmiRHV57EUkFWJzuntsG8BG15wFSwam6',
|
"path/to/storage/config.yml", "path/to/storage/config/dir", {}, {
|
||||||
});
|
'testbucket' : 'GBQDDUM1hdodXmiRHV57EUkFWJzuntsG8BG15wFSwam6',
|
||||||
|
});
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
const key = uuidv4();
|
const key = uuidv4();
|
||||||
if (s3local_cli.put(bucket, key, payload).success) {
|
if (s3local_cli.put(bucket, key, payload).success) {
|
||||||
s3local_cli.get(bucket, key)
|
s3local_cli.get(bucket, key)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
|
@ -264,6 +265,16 @@ func (c *Client) PutContainer(params map[string]string) PutContainerResponse {
|
||||||
container.SetCreationTime(&cnr, time.Now())
|
container.SetCreationTime(&cnr, time.Now())
|
||||||
cnr.SetOwner(usr)
|
cnr.SetOwner(usr)
|
||||||
|
|
||||||
|
if basicACLStr, ok := params["acl"]; ok {
|
||||||
|
var basicACL acl.Basic
|
||||||
|
err := basicACL.DecodeString(basicACLStr)
|
||||||
|
if err != nil {
|
||||||
|
return c.putCnrErrorResponse(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cnr.SetBasicACL(basicACL)
|
||||||
|
}
|
||||||
|
|
||||||
placementPolicyStr, ok := params["placement_policy"]
|
placementPolicyStr, ok := params["placement_policy"]
|
||||||
if ok {
|
if ok {
|
||||||
var placementPolicy netmap.PlacementPolicy
|
var placementPolicy netmap.PlacementPolicy
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
import { sleep } from 'k6';
|
import {sleep} from 'k6';
|
||||||
import { SharedArray } from 'k6/data';
|
import {SharedArray} from 'k6/data';
|
||||||
import exec from 'k6/execution';
|
import exec from 'k6/execution';
|
||||||
import logging from 'k6/x/frostfs/logging';
|
import logging from 'k6/x/frostfs/logging';
|
||||||
import native from 'k6/x/frostfs/native';
|
import native from 'k6/x/frostfs/native';
|
||||||
import registry from 'k6/x/frostfs/registry';
|
import registry from 'k6/x/frostfs/registry';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import { newGenerator } from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import { parseEnv } from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import { textSummary } from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
import { uuidv4 } from './libs/k6-utils-1.4.0.js';
|
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray(
|
const obj_list = new SharedArray(
|
||||||
'obj_list',
|
'obj_list',
|
||||||
function () { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const container_list = new SharedArray(
|
const container_list = new SharedArray(
|
||||||
'container_list',
|
'container_list',
|
||||||
function () { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||||
|
|
||||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
@ -31,7 +31,8 @@ const grpc_endpoint =
|
||||||
const grpc_client = native.connect(
|
const grpc_client = native.connect(
|
||||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||||
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
||||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true' : false,
|
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true'
|
||||||
|
: false,
|
||||||
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
||||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||||
|
|
||||||
|
@ -51,8 +52,8 @@ if (registry_enabled) {
|
||||||
obj_to_read_selector = registry.getLoopedSelector(
|
obj_to_read_selector = registry.getLoopedSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: read_age,
|
age : read_age,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,11 +64,11 @@ const write_grpc_chunk_size = 1024 * parseInt(__ENV.GRPC_CHUNK_SIZE || '0')
|
||||||
const generator = newGenerator(write_vu_count > 0);
|
const generator = newGenerator(write_vu_count > 0);
|
||||||
if (write_vu_count > 0) {
|
if (write_vu_count > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: write_vu_count,
|
vus : write_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,19 +84,19 @@ if (registry_enabled && delete_age) {
|
||||||
obj_to_delete_selector =
|
obj_to_delete_selector =
|
||||||
constructor(__ENV.REGISTRY_FILE, 'obj_to_delete',
|
constructor(__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: delete_age,
|
age : delete_age,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||||
if (read_vu_count > 0) {
|
if (read_vu_count > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: read_vu_count,
|
vus : read_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,17 +108,17 @@ if (delete_vu_count > 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: delete_vu_count,
|
vus : delete_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_delete',
|
exec : 'obj_delete',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -147,8 +148,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, { indent: ' ', enableColors: false }),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +158,7 @@ export function obj_write() {
|
||||||
sleep(__ENV.SLEEP_WRITE);
|
sleep(__ENV.SLEEP_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = { unique_header: uuidv4() };
|
const headers = {unique_header : uuidv4()};
|
||||||
const container =
|
const container =
|
||||||
container_list[Math.floor(Math.random() * container_list.length)];
|
container_list[Math.floor(Math.random() * container_list.length)];
|
||||||
|
|
||||||
|
@ -186,7 +187,7 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -194,7 +195,7 @@ export function obj_read() {
|
||||||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
const resp = grpc_client.get(obj.container, obj.object)
|
const resp = grpc_client.get(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({ cid: obj.container, oid: obj.object }).error(resp.error);
|
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +215,7 @@ export function obj_delete() {
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
// Log errors except (2052 - object already deleted)
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import { sleep } from 'k6';
|
import {sleep} from 'k6';
|
||||||
import { SharedArray } from 'k6/data';
|
import {SharedArray} from 'k6/data';
|
||||||
import logging from 'k6/x/frostfs/logging';
|
import logging from 'k6/x/frostfs/logging';
|
||||||
import native from 'k6/x/frostfs/native';
|
import native from 'k6/x/frostfs/native';
|
||||||
import registry from 'k6/x/frostfs/registry';
|
import registry from 'k6/x/frostfs/registry';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import { newGenerator } from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import { parseEnv } from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import { textSummary } from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
import { uuidv4 } from './libs/k6-utils-1.4.0.js';
|
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray('obj_list', function () {
|
const obj_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
'obj_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const container_list = new SharedArray('container_list', function () {
|
const container_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
'container_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||||
|
|
||||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
@ -30,7 +30,8 @@ const grpc_endpoint =
|
||||||
const grpc_client = native.connect(
|
const grpc_client = native.connect(
|
||||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||||
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 60,
|
||||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true' : false,
|
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true'
|
||||||
|
: false,
|
||||||
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
||||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||||
|
|
||||||
|
@ -50,8 +51,8 @@ if (registry_enabled && delete_age) {
|
||||||
obj_to_delete_selector = registry.getSelector(
|
obj_to_delete_selector = registry.getSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: delete_age,
|
age : delete_age,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +62,8 @@ if (registry_enabled) {
|
||||||
obj_to_read_selector = registry.getLoopedSelector(
|
obj_to_read_selector = registry.getLoopedSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: read_age,
|
age : read_age,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,14 +77,14 @@ const write_grpc_chunk_size = 1024 * parseInt(__ENV.GRPC_CHUNK_SIZE || '0')
|
||||||
const generator = newGenerator(write_rate > 0);
|
const generator = newGenerator(write_rate > 0);
|
||||||
if (write_rate > 0) {
|
if (write_rate > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_write_vus,
|
preAllocatedVUs : pre_alloc_write_vus,
|
||||||
maxVUs: max_write_vus,
|
maxVUs : max_write_vus,
|
||||||
rate: write_rate,
|
rate : write_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,14 +93,14 @@ const max_read_vus = parseInt(__ENV.MAX_READERS || pre_alloc_read_vus);
|
||||||
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
||||||
if (read_rate > 0) {
|
if (read_rate > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_write_vus,
|
preAllocatedVUs : pre_alloc_write_vus,
|
||||||
maxVUs: max_read_vus,
|
maxVUs : max_read_vus,
|
||||||
rate: read_rate,
|
rate : read_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,20 +114,20 @@ if (delete_rate > 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_delete_vus,
|
preAllocatedVUs : pre_alloc_delete_vus,
|
||||||
maxVUs: max_delete_vus,
|
maxVUs : max_delete_vus,
|
||||||
rate: delete_rate,
|
rate : delete_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_delete',
|
exec : 'obj_delete',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -166,8 +167,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, { indent: ' ', enableColors: false }),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ export function obj_write() {
|
||||||
sleep(__ENV.SLEEP_WRITE);
|
sleep(__ENV.SLEEP_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = { unique_header: uuidv4() };
|
const headers = {unique_header : uuidv4()};
|
||||||
const container =
|
const container =
|
||||||
container_list[Math.floor(Math.random() * container_list.length)];
|
container_list[Math.floor(Math.random() * container_list.length)];
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
const resp = grpc_client.get(obj.c_id, obj.o_id)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,7 @@ export function obj_read() {
|
||||||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
const resp = grpc_client.get(obj.container, obj.object)
|
const resp = grpc_client.get(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({ cid: obj.container, oid: obj.object }).error(resp.error);
|
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +231,7 @@ export function obj_delete() {
|
||||||
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
const resp = grpc_client.delete(obj.c_id, obj.o_id);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
// Log errors except (2052 - object already deleted)
|
||||||
log.withFields({ cid: obj.c_id, oid: obj.o_id }).error(resp.error);
|
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray('obj_list', function() {
|
const obj_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
'obj_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const container_list = new SharedArray('container_list', function() {
|
const container_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
'container_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||||
|
|
||||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
@ -45,28 +45,28 @@ const write_vu_count = parseInt(__ENV.WRITERS || '0');
|
||||||
const generator = newGenerator(write_vu_count > 0);
|
const generator = newGenerator(write_vu_count > 0);
|
||||||
if (write_vu_count > 0) {
|
if (write_vu_count > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: write_vu_count,
|
vus : write_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||||
if (read_vu_count > 0) {
|
if (read_vu_count > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: read_vu_count,
|
vus : read_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -95,8 +95,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,16 +110,16 @@ export function obj_write() {
|
||||||
|
|
||||||
const payload = generator.genPayload();
|
const payload = generator.genPayload();
|
||||||
const data = {
|
const data = {
|
||||||
field: uuidv4(),
|
field : uuidv4(),
|
||||||
// Because we use `file` wrapping and it is not straightforward to use
|
// Because we use `file` wrapping and it is not straightforward to use
|
||||||
// streams here,
|
// streams here,
|
||||||
// `-e STREAMING=1` has no effect for this scenario.
|
// `-e STREAMING=1` has no effect for this scenario.
|
||||||
file: http.file(payload.bytes(), 'random.data'),
|
file : http.file(payload.bytes(), 'random.data'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = http.post(`http://${http_endpoint}/upload/${container}`, data);
|
const resp = http.post(`http://${http_endpoint}/upload/${container}`, data);
|
||||||
if (resp.status != 200) {
|
if (resp.status != 200) {
|
||||||
log.withFields({status: resp.status, cid: container}).error(resp.error);
|
log.withFields({status : resp.status, cid : container}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const object_id = JSON.parse(resp.body).object_id;
|
const object_id = JSON.parse(resp.body).object_id;
|
||||||
|
@ -137,7 +137,8 @@ export function obj_read() {
|
||||||
const resp =
|
const resp =
|
||||||
http.get(`http://${http_endpoint}/get/${obj.container}/${obj.object}`);
|
http.get(`http://${http_endpoint}/get/${obj.container}/${obj.object}`);
|
||||||
if (resp.status != 200) {
|
if (resp.status != 200) {
|
||||||
log.withFields({status: resp.status, cid: obj.container, oid: obj.object})
|
log.withFields(
|
||||||
|
{status : resp.status, cid : obj.container, oid : obj.object})
|
||||||
.error(resp.error);
|
.error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray('obj_list', function() {
|
const obj_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
'obj_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const container_list = new SharedArray('container_list', function() {
|
const container_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
'container_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||||
|
|
||||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
@ -31,7 +31,7 @@ const max_total_size_gb =
|
||||||
const local_client =
|
const local_client =
|
||||||
local.connect(config_file, config_dir, '', debug_logger, max_total_size_gb);
|
local.connect(config_file, config_dir, '', debug_logger, max_total_size_gb);
|
||||||
const log = logging.new().withFields(
|
const log = logging.new().withFields(
|
||||||
{'config_file': config_file, 'config_dir': config_dir});
|
{'config_file' : config_file, 'config_dir' : config_dir});
|
||||||
|
|
||||||
const registry_enabled = !!__ENV.REGISTRY_FILE;
|
const registry_enabled = !!__ENV.REGISTRY_FILE;
|
||||||
const obj_registry =
|
const obj_registry =
|
||||||
|
@ -49,8 +49,8 @@ if (registry_enabled && delete_age) {
|
||||||
obj_to_delete_selector = registry.getSelector(
|
obj_to_delete_selector = registry.getSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: delete_age,
|
age : delete_age,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,22 +60,22 @@ const write_vu_count = parseInt(__ENV.WRITERS || '0');
|
||||||
const generator = newGenerator(write_vu_count > 0);
|
const generator = newGenerator(write_vu_count > 0);
|
||||||
if (write_vu_count > 0) {
|
if (write_vu_count > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: write_vu_count,
|
vus : write_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||||
if (read_vu_count > 0) {
|
if (read_vu_count > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: read_vu_count,
|
vus : read_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,17 +87,17 @@ if (delete_vu_count > 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: delete_vu_count,
|
vus : delete_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_delete',
|
exec : 'obj_delete',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -127,13 +127,13 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function obj_write() {
|
export function obj_write() {
|
||||||
const headers = {unique_header: uuidv4()};
|
const headers = {unique_header : uuidv4()};
|
||||||
const container =
|
const container =
|
||||||
container_list[Math.floor(Math.random() * container_list.length)];
|
container_list[Math.floor(Math.random() * container_list.length)];
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ export function obj_read() {
|
||||||
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
const obj = obj_list[Math.floor(Math.random() * obj_list.length)];
|
||||||
const resp = local_client.get(obj.container, obj.object)
|
const resp = local_client.get(obj.container, obj.object)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({cid: obj.container, oid: obj.object}).error(resp.error);
|
log.withFields({cid : obj.container, oid : obj.object}).error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ export function obj_delete() {
|
||||||
const resp = local_client.delete(obj.c_id, obj.o_id);
|
const resp = local_client.delete(obj.c_id, obj.o_id);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
// Log errors except (2052 - object already deleted)
|
// Log errors except (2052 - object already deleted)
|
||||||
log.withFields({cid: obj.c_id, oid: obj.o_id}).error(resp.error);
|
log.withFields({cid : obj.c_id, oid : obj.o_id}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
from helpers.cmd import execute_cmd, log
|
from helpers.cmd import execute_cmd, log
|
||||||
|
|
||||||
def create_container(endpoint, policy, container_creation_retry, wallet_path, config, rules, local=False, retry=0):
|
def create_container(endpoint, policy, container_creation_retry, wallet_path, config, acl, local=False, retry=0):
|
||||||
if retry > int(container_creation_retry):
|
if retry > int(container_creation_retry):
|
||||||
raise ValueError(f"unable to create container: too many unsuccessful attempts")
|
raise ValueError(f"unable to create container: too many unsuccessful attempts")
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ def create_container(endpoint, policy, container_creation_retry, wallet_path, co
|
||||||
wallet_file = f"--wallet {wallet_path}"
|
wallet_file = f"--wallet {wallet_path}"
|
||||||
if config:
|
if config:
|
||||||
wallet_config = f"--config {config}"
|
wallet_config = f"--config {config}"
|
||||||
|
if acl:
|
||||||
|
acl_param = f"--basic-acl {acl}"
|
||||||
cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} container create {wallet_file} {wallet_config} " \
|
cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} container create {wallet_file} {wallet_config} " \
|
||||||
f" --policy '{policy}' --await"
|
f" --policy '{policy}' {acl_param} --await"
|
||||||
|
|
||||||
output, success = execute_cmd(cmd_line)
|
output, success = execute_cmd(cmd_line)
|
||||||
|
|
||||||
|
@ -34,20 +36,6 @@ def create_container(endpoint, policy, container_creation_retry, wallet_path, co
|
||||||
|
|
||||||
log(f"Created container: {cid} ({policy})", endpoint)
|
log(f"Created container: {cid} ({policy})", endpoint)
|
||||||
|
|
||||||
# Add rule for container
|
|
||||||
if rules:
|
|
||||||
r = ""
|
|
||||||
for rule in rules:
|
|
||||||
r += f" --rule '{rule}' "
|
|
||||||
cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} ape-manager add {wallet_file} {wallet_config} " \
|
|
||||||
f" --chain-id 'chain-id' {r} --target-name '{cid}' --target-type 'container'"
|
|
||||||
output, success = execute_cmd(cmd_line)
|
|
||||||
if not success:
|
|
||||||
log(f"{cmd_line}\n"
|
|
||||||
f"Rule has not been added\n"
|
|
||||||
f"{output}", endpoint)
|
|
||||||
return False
|
|
||||||
|
|
||||||
if not local:
|
if not local:
|
||||||
return cid
|
return cid
|
||||||
|
|
||||||
|
@ -100,7 +88,7 @@ def create_container(endpoint, policy, container_creation_retry, wallet_path, co
|
||||||
return cid
|
return cid
|
||||||
|
|
||||||
log(f"Created container {cid} is not stored on {endpoint}, creating another one...", endpoint)
|
log(f"Created container {cid} is not stored on {endpoint}, creating another one...", endpoint)
|
||||||
return create_container(endpoint, policy, container_creation_retry, wallet_path, config, rules, local, retry + 1)
|
return create_container(endpoint, policy, container_creation_retry, wallet_path, config, acl, local, retry + 1)
|
||||||
|
|
||||||
|
|
||||||
def upload_object(container, payload_filepath, endpoint, wallet_file, wallet_config):
|
def upload_object(container, payload_filepath, endpoint, wallet_file, wallet_config):
|
||||||
|
|
|
@ -16,7 +16,6 @@ ERROR_WRONG_CONTAINERS_COUNT = 1
|
||||||
ERROR_WRONG_OBJECTS_COUNT = 2
|
ERROR_WRONG_OBJECTS_COUNT = 2
|
||||||
MAX_WORKERS = 50
|
MAX_WORKERS = 50
|
||||||
DEFAULT_POLICY = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
DEFAULT_POLICY = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||||
DEFAULT_RULES = ["allow Object.* *"]
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--size', help='Upload objects size in kb')
|
parser.add_argument('--size', help='Upload objects size in kb')
|
||||||
|
@ -38,10 +37,7 @@ parser.add_argument('--workers', help='Count of workers in preset. Max = 50, Def
|
||||||
parser.add_argument('--sleep', help='Time to sleep between containers creation and objects upload (in seconds), '
|
parser.add_argument('--sleep', help='Time to sleep between containers creation and objects upload (in seconds), '
|
||||||
'Default = 8', default=8)
|
'Default = 8', default=8)
|
||||||
parser.add_argument('--local', help='Create containers that store data on provided endpoints. Warning: additional empty containers may be created.', action='store_true')
|
parser.add_argument('--local', help='Create containers that store data on provided endpoints. Warning: additional empty containers may be created.', action='store_true')
|
||||||
parser.add_argument(
|
parser.add_argument('--acl', help='Container ACL. Default is public-read-write.', default='public-read-write')
|
||||||
'--rule',
|
|
||||||
help='Rule attached to created containers. All entries of CONTAINER_ID will be replaced with id of created container.',
|
|
||||||
action="append")
|
|
||||||
|
|
||||||
args: Namespace = parser.parse_args()
|
args: Namespace = parser.parse_args()
|
||||||
print(args)
|
print(args)
|
||||||
|
@ -60,9 +56,6 @@ def main():
|
||||||
wallet_config = args.config
|
wallet_config = args.config
|
||||||
workers = int(args.workers)
|
workers = int(args.workers)
|
||||||
objects_per_container = int(args.preload_obj)
|
objects_per_container = int(args.preload_obj)
|
||||||
rules = args.rule
|
|
||||||
if not rules:
|
|
||||||
rules = DEFAULT_RULES
|
|
||||||
|
|
||||||
ignore_errors = args.ignore_errors
|
ignore_errors = args.ignore_errors
|
||||||
if args.update:
|
if args.update:
|
||||||
|
@ -75,7 +68,7 @@ def main():
|
||||||
containers_count = int(args.containers)
|
containers_count = int(args.containers)
|
||||||
print(f"Create containers: {containers_count}")
|
print(f"Create containers: {containers_count}")
|
||||||
with ProcessPoolExecutor(max_workers=min(MAX_WORKERS, workers)) as executor:
|
with ProcessPoolExecutor(max_workers=min(MAX_WORKERS, workers)) as executor:
|
||||||
containers_runs = [executor.submit(create_container, endpoint, policy, container_creation_retry, wallet, wallet_config, rules, args.local)
|
containers_runs = [executor.submit(create_container, endpoint, policy, container_creation_retry, wallet, wallet_config, args.acl, args.local)
|
||||||
for _, endpoint, policy in
|
for _, endpoint, policy in
|
||||||
zip(range(containers_count), cycle(endpoints), cycle(args.policy))]
|
zip(range(containers_count), cycle(endpoints), cycle(args.policy))]
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ import registry from 'k6/x/frostfs/registry';
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import {generateS3Key} from './libs/keygen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import {parseEnv} from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
import {newGenerator} from './libs/datagen.js';
|
import {generateS3Key} from './libs/keygen.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ export function setup() {
|
||||||
console.log(
|
console.log(
|
||||||
`Load started at: ${Date(start_timestamp).toString()}`)
|
`Load started at: ${Date(start_timestamp).toString()}`)
|
||||||
|
|
||||||
if (delete_vu_count > 0){
|
if (delete_vu_count > 0) {
|
||||||
obj_to_delete_selector.sync.add(delete_vu_count)
|
obj_to_delete_selector.sync.add(delete_vu_count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,20 @@ import registry from 'k6/x/frostfs/registry';
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import {generateS3Key} from './libs/keygen.js';
|
|
||||||
import {newGenerator} from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import {parseEnv} from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
|
import {generateS3Key} from './libs/keygen.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray('obj_list', function() {
|
const obj_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
'obj_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const bucket_list = new SharedArray('bucket_list', function() {
|
const bucket_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
'bucket_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||||
|
|
||||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
@ -29,7 +29,7 @@ const s3_endpoint =
|
||||||
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
||||||
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
||||||
const connection_args = {
|
const connection_args = {
|
||||||
no_verify_ssl: no_verify_ssl
|
no_verify_ssl : no_verify_ssl
|
||||||
};
|
};
|
||||||
const s3_client = s3.connect(s3_endpoint, connection_args);
|
const s3_client = s3.connect(s3_endpoint, connection_args);
|
||||||
const log = logging.new().withField('endpoint', s3_endpoint);
|
const log = logging.new().withField('endpoint', s3_endpoint);
|
||||||
|
@ -50,8 +50,8 @@ if (registry_enabled && delete_age) {
|
||||||
obj_to_delete_selector = registry.getSelector(
|
obj_to_delete_selector = registry.getSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: delete_age,
|
age : delete_age,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ if (registry_enabled) {
|
||||||
obj_to_read_selector = registry.getLoopedSelector(
|
obj_to_read_selector = registry.getLoopedSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
age: read_age,
|
age : read_age,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,35 +75,33 @@ const write_rate = parseInt(__ENV.WRITE_RATE || '0');
|
||||||
const generator = newGenerator(write_rate > 0);
|
const generator = newGenerator(write_rate > 0);
|
||||||
if (write_rate > 0) {
|
if (write_rate > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_write_vus,
|
preAllocatedVUs : pre_alloc_write_vus,
|
||||||
maxVUs: max_write_vus,
|
maxVUs : max_write_vus,
|
||||||
rate: write_rate,
|
rate : write_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const pre_alloc_read_vus = parseInt(__ENV.PRE_ALLOC_READERS || '0');
|
const pre_alloc_read_vus = parseInt(__ENV.PRE_ALLOC_READERS || '0');
|
||||||
const max_read_vus = parseInt(__ENV.MAX_READERS || pre_alloc_read_vus);
|
const max_read_vus = parseInt(__ENV.MAX_READERS || pre_alloc_read_vus);
|
||||||
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
const read_rate = parseInt(__ENV.READ_RATE || '0');
|
||||||
if (read_rate > 0) {
|
if (read_rate > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_write_vus,
|
preAllocatedVUs : pre_alloc_write_vus,
|
||||||
maxVUs: max_read_vus,
|
maxVUs : max_read_vus,
|
||||||
rate: read_rate,
|
rate : read_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const pre_alloc_delete_vus = parseInt(__ENV.PRE_ALLOC_DELETERS || '0');
|
const pre_alloc_delete_vus = parseInt(__ENV.PRE_ALLOC_DELETERS || '0');
|
||||||
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
const max_delete_vus = parseInt(__ENV.MAX_DELETERS || pre_alloc_write_vus);
|
||||||
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
const delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
||||||
|
@ -114,20 +112,20 @@ if (delete_rate > 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios.delete = {
|
scenarios.delete = {
|
||||||
executor: 'constant-arrival-rate',
|
executor : 'constant-arrival-rate',
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
preAllocatedVUs: pre_alloc_delete_vus,
|
preAllocatedVUs : pre_alloc_delete_vus,
|
||||||
maxVUs: max_delete_vus,
|
maxVUs : max_delete_vus,
|
||||||
rate: delete_rate,
|
rate : delete_rate,
|
||||||
timeUnit: time_unit,
|
timeUnit : time_unit,
|
||||||
exec: 'obj_delete',
|
exec : 'obj_delete',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -167,8 +165,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +181,7 @@ export function obj_write() {
|
||||||
const payload = generator.genPayload();
|
const payload = generator.genPayload();
|
||||||
const resp = s3_client.put(bucket, key, payload);
|
const resp = s3_client.put(bucket, key, payload);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: bucket, key: key}).error(resp.error);
|
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +202,7 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key})
|
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
|
||||||
.error(resp.error);
|
.error(resp.error);
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -214,7 +212,7 @@ export function obj_read() {
|
||||||
|
|
||||||
const resp = s3_client.get(obj.bucket, obj.object);
|
const resp = s3_client.get(obj.bucket, obj.object);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.bucket, key: obj.object}).error(resp.error);
|
log.withFields({bucket : obj.bucket, key : obj.object}).error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +228,7 @@ export function obj_delete() {
|
||||||
|
|
||||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key, op: 'DELETE'})
|
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
|
||||||
.error(resp.error);
|
.error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@ import registry from 'k6/x/frostfs/registry';
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import {generateS3Key} from './libs/keygen.js';
|
|
||||||
import {newGenerator} from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import {parseEnv} from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
|
import {generateS3Key} from './libs/keygen.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ const delete_age = __ENV.DELETE_AGE ? parseInt(__ENV.DELETE_AGE) : undefined;
|
||||||
let obj_to_delete_selector = undefined;
|
let obj_to_delete_selector = undefined;
|
||||||
let obj_to_delete_exit_on_null = undefined;
|
let obj_to_delete_exit_on_null = undefined;
|
||||||
|
|
||||||
if (registry_enabled ) {
|
if (registry_enabled) {
|
||||||
obj_to_delete_exit_on_null = (write_vu_count == 0) && (read_vu_count == 0)
|
obj_to_delete_exit_on_null = (write_vu_count == 0) && (read_vu_count == 0)
|
||||||
|
|
||||||
let constructor = obj_to_delete_exit_on_null ? registry.getOneshotSelector
|
let constructor = obj_to_delete_exit_on_null ? registry.getOneshotSelector
|
||||||
|
@ -100,8 +100,6 @@ if (registry_enabled ) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||||
if (delete_vu_count > 0) {
|
if (delete_vu_count > 0) {
|
||||||
if (!obj_to_delete_selector) {
|
if (!obj_to_delete_selector) {
|
||||||
|
@ -181,14 +179,20 @@ export function obj_read() {
|
||||||
|
|
||||||
if (obj_to_read_selector) {
|
if (obj_to_read_selector) {
|
||||||
const obj = obj_to_read_selector.nextObject();
|
const obj = obj_to_read_selector.nextObject();
|
||||||
if (!obj ) {
|
if (!obj) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, status: obj.status, op: `READ`})
|
log.withFields({
|
||||||
|
bucket : obj.s3_bucket,
|
||||||
|
key : obj.s3_key,
|
||||||
|
status : obj.status,
|
||||||
|
op : `READ`
|
||||||
|
})
|
||||||
.error(resp.error);
|
.error(resp.error);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
|
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ import registry from 'k6/x/frostfs/registry';
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import {generateS3Key} from './libs/keygen.js';
|
|
||||||
import {newGenerator} from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import {parseEnv} from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
|
import {generateS3Key} from './libs/keygen.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const bucket_list = new SharedArray('bucket_list', function() {
|
const bucket_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
'bucket_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||||
|
|
||||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ const s3_endpoint =
|
||||||
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
||||||
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
||||||
const connection_args = {
|
const connection_args = {
|
||||||
no_verify_ssl: no_verify_ssl
|
no_verify_ssl : no_verify_ssl
|
||||||
};
|
};
|
||||||
const s3_client = s3.connect(s3_endpoint, connection_args);
|
const s3_client = s3.connect(s3_endpoint, connection_args);
|
||||||
const log = logging.new().withField('endpoint', s3_endpoint);
|
const log = logging.new().withField('endpoint', s3_endpoint);
|
||||||
|
@ -55,17 +55,17 @@ const generator =
|
||||||
newGenerator(write_vu_count > 0 || write_multipart_vu_count > 0);
|
newGenerator(write_vu_count > 0 || write_multipart_vu_count > 0);
|
||||||
if (write_vu_count > 0) {
|
if (write_vu_count > 0) {
|
||||||
scenarios.write_multipart = {
|
scenarios.write_multipart = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: write_vu_count,
|
vus : write_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_write_multipart',
|
exec : 'obj_write_multipart',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -85,8 +85,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +105,10 @@ export function obj_write_multipart() {
|
||||||
const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)];
|
const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)];
|
||||||
|
|
||||||
const payload = generator.genPayload();
|
const payload = generator.genPayload();
|
||||||
const resp = s3_client.multipart(
|
const resp = s3_client.multipart(bucket, key, write_multipart_part_size,
|
||||||
bucket, key, write_multipart_part_size, write_multipart_vu_count,
|
write_multipart_vu_count, payload);
|
||||||
payload);
|
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: bucket, key: key}).error(resp.error);
|
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,25 @@ import registry from 'k6/x/frostfs/registry';
|
||||||
import s3local from 'k6/x/frostfs/s3local';
|
import s3local from 'k6/x/frostfs/s3local';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import {generateS3Key} from './libs/keygen.js';
|
|
||||||
import {newGenerator} from './libs/datagen.js';
|
import {newGenerator} from './libs/datagen.js';
|
||||||
import {parseEnv} from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||||
|
import {generateS3Key} from './libs/keygen.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
const obj_list = new SharedArray('obj_list', function() {
|
const obj_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
'obj_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||||
|
|
||||||
const container_list = new SharedArray('container_list', function() {
|
const container_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
'container_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||||
|
|
||||||
const bucket_list = new SharedArray('bucket_list', function() {
|
const bucket_list = new SharedArray(
|
||||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
'bucket_list',
|
||||||
});
|
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||||
|
|
||||||
function bucket_mapping() {
|
function bucket_mapping() {
|
||||||
if (container_list.length != bucket_list.length) {
|
if (container_list.length != bucket_list.length) {
|
||||||
|
@ -43,13 +43,12 @@ const config_file = __ENV.CONFIG_FILE;
|
||||||
const config_dir = __ENV.CONFIG_DIR;
|
const config_dir = __ENV.CONFIG_DIR;
|
||||||
const max_total_size_gb =
|
const max_total_size_gb =
|
||||||
__ENV.MAX_TOTAL_SIZE_GB ? parseInt(__ENV.MAX_TOTAL_SIZE_GB) : 0;
|
__ENV.MAX_TOTAL_SIZE_GB ? parseInt(__ENV.MAX_TOTAL_SIZE_GB) : 0;
|
||||||
const s3_client = s3local.connect(
|
const s3_client = s3local.connect(config_file, config_dir, {
|
||||||
config_file, config_dir, {
|
'debug_logger' : __ENV.DEBUG_LOGGER || 'false',
|
||||||
'debug_logger': __ENV.DEBUG_LOGGER || 'false',
|
},
|
||||||
},
|
|
||||||
bucket_mapping(), max_total_size_gb);
|
bucket_mapping(), max_total_size_gb);
|
||||||
const log = logging.new().withFields(
|
const log = logging.new().withFields(
|
||||||
{'config_file': config_file, 'config_dir': config_dir});
|
{'config_file' : config_file, 'config_dir' : config_dir});
|
||||||
|
|
||||||
if (!!__ENV.METRIC_TAGS) {
|
if (!!__ENV.METRIC_TAGS) {
|
||||||
stats.setTags(__ENV.METRIC_TAGS)
|
stats.setTags(__ENV.METRIC_TAGS)
|
||||||
|
@ -64,7 +63,7 @@ if (registry_enabled) {
|
||||||
obj_to_read_selector = registry.getLoopedSelector(
|
obj_to_read_selector = registry.getLoopedSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_read',
|
__ENV.REGISTRY_FILE, 'obj_to_read',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,28 +75,28 @@ const write_vu_count = parseInt(__ENV.WRITERS || '0');
|
||||||
const generator = newGenerator(write_vu_count > 0);
|
const generator = newGenerator(write_vu_count > 0);
|
||||||
if (write_vu_count > 0) {
|
if (write_vu_count > 0) {
|
||||||
scenarios.write = {
|
scenarios.write = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: write_vu_count,
|
vus : write_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_write',
|
exec : 'obj_write',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const read_vu_count = parseInt(__ENV.READERS || '0');
|
const read_vu_count = parseInt(__ENV.READERS || '0');
|
||||||
if (read_vu_count > 0) {
|
if (read_vu_count > 0) {
|
||||||
scenarios.read = {
|
scenarios.read = {
|
||||||
executor: 'constant-vus',
|
executor : 'constant-vus',
|
||||||
vus: read_vu_count,
|
vus : read_vu_count,
|
||||||
duration: `${duration}s`,
|
duration : `${duration}s`,
|
||||||
exec: 'obj_read',
|
exec : 'obj_read',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -126,8 +125,8 @@ export function teardown(data) {
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, {indent: ' ', enableColors: false}),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ export function obj_write() {
|
||||||
if (resp.abort) {
|
if (resp.abort) {
|
||||||
exec.test.abort(resp.error);
|
exec.test.abort(resp.error);
|
||||||
}
|
}
|
||||||
log.withFields({bucket: bucket, key: key}).error(resp.error);
|
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +157,7 @@ export function obj_read() {
|
||||||
}
|
}
|
||||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.s3_bucket, key: obj.s3_key})
|
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
|
||||||
.error(resp.error);
|
.error(resp.error);
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -168,6 +167,6 @@ export function obj_read() {
|
||||||
|
|
||||||
const resp = s3_client.get(obj.bucket, obj.object);
|
const resp = s3_client.get(obj.bucket, obj.object);
|
||||||
if (!resp.success) {
|
if (!resp.success) {
|
||||||
log.withFields({bucket: obj.bucket, key: obj.object}).error(resp.error);
|
log.withFields({bucket : obj.bucket, key : obj.object}).error(resp.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { sleep } from 'k6';
|
import {sleep} from 'k6';
|
||||||
import { Counter } from 'k6/metrics';
|
import {Counter} from 'k6/metrics';
|
||||||
import logging from 'k6/x/frostfs/logging';
|
import logging from 'k6/x/frostfs/logging';
|
||||||
import native from 'k6/x/frostfs/native';
|
import native from 'k6/x/frostfs/native';
|
||||||
import registry from 'k6/x/frostfs/registry';
|
import registry from 'k6/x/frostfs/registry';
|
||||||
import s3 from 'k6/x/frostfs/s3';
|
import s3 from 'k6/x/frostfs/s3';
|
||||||
import stats from 'k6/x/frostfs/stats';
|
import stats from 'k6/x/frostfs/stats';
|
||||||
|
|
||||||
import { parseEnv } from './libs/env-parser.js';
|
import {parseEnv} from './libs/env-parser.js';
|
||||||
import { textSummary } from './libs/k6-summary-0.0.2.js';
|
import {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||||
|
|
||||||
parseEnv();
|
parseEnv();
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||||
// This allows to run this scenario multiple times and collect overall
|
// This allows to run this scenario multiple times and collect overall
|
||||||
// statistics in the final run.
|
// statistics in the final run.
|
||||||
const obj_counters = {
|
const obj_counters = {
|
||||||
verified: new Counter('verified_obj'),
|
verified : new Counter('verified_obj'),
|
||||||
skipped: new Counter('skipped_obj'),
|
skipped : new Counter('skipped_obj'),
|
||||||
invalid: new Counter('invalid_obj'),
|
invalid : new Counter('invalid_obj'),
|
||||||
};
|
};
|
||||||
|
|
||||||
let log = logging.new();
|
let log = logging.new();
|
||||||
|
@ -44,7 +44,8 @@ if (__ENV.GRPC_ENDPOINTS) {
|
||||||
grpc_client = native.connect(
|
grpc_client = native.connect(
|
||||||
grpcEndpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 0,
|
grpcEndpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 0,
|
||||||
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 0,
|
__ENV.STREAM_TIMEOUT ? parseInt(__ENV.STREAM_TIMEOUT) : 0,
|
||||||
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true' : false,
|
__ENV.PREPARE_LOCALLY ? __ENV.PREPARE_LOCALLY.toLowerCase() === 'true'
|
||||||
|
: false,
|
||||||
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
1024 * parseInt(__ENV.MAX_OBJECT_SIZE || '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ if (__ENV.GRPC_ENDPOINTS) {
|
||||||
let s3_client = undefined;
|
let s3_client = undefined;
|
||||||
if (__ENV.S3_ENDPOINTS) {
|
if (__ENV.S3_ENDPOINTS) {
|
||||||
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
const no_verify_ssl = __ENV.NO_VERIFY_SSL || 'true';
|
||||||
const connection_args = { no_verify_ssl: no_verify_ssl };
|
const connection_args = {no_verify_ssl : no_verify_ssl};
|
||||||
const s3_endpoints = __ENV.S3_ENDPOINTS.split(',');
|
const s3_endpoints = __ENV.S3_ENDPOINTS.split(',');
|
||||||
const s3_endpoint =
|
const s3_endpoint =
|
||||||
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
s3_endpoints[Math.floor(Math.random() * s3_endpoints.length)];
|
||||||
|
@ -66,8 +67,8 @@ if (__ENV.S3_ENDPOINTS) {
|
||||||
const obj_to_verify_selector = registry.getSelector(
|
const obj_to_verify_selector = registry.getSelector(
|
||||||
__ENV.REGISTRY_FILE, 'obj_to_verify',
|
__ENV.REGISTRY_FILE, 'obj_to_verify',
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||||
status: 'created',
|
status : 'created',
|
||||||
});
|
});
|
||||||
const obj_to_verify_count = obj_to_verify_selector.count();
|
const obj_to_verify_count = obj_to_verify_selector.count();
|
||||||
// Execute at least one iteration (executor shared-iterations can't run 0
|
// Execute at least one iteration (executor shared-iterations can't run 0
|
||||||
// iterations)
|
// iterations)
|
||||||
|
@ -77,19 +78,19 @@ const iterations = Math.max(1, obj_to_verify_count);
|
||||||
const vus = Math.min(__ENV.CLIENTS, iterations);
|
const vus = Math.min(__ENV.CLIENTS, iterations);
|
||||||
|
|
||||||
const scenarios = {
|
const scenarios = {
|
||||||
verify: {
|
verify : {
|
||||||
executor: 'shared-iterations',
|
executor : 'shared-iterations',
|
||||||
vus,
|
vus,
|
||||||
iterations,
|
iterations,
|
||||||
maxDuration: `${time_limit}s`,
|
maxDuration : `${time_limit}s`,
|
||||||
exec: 'obj_verify',
|
exec : 'obj_verify',
|
||||||
gracefulStop: '5s',
|
gracefulStop : '5s',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const options = {
|
export const options = {
|
||||||
scenarios,
|
scenarios,
|
||||||
setupTimeout: '5s',
|
setupTimeout : '5s',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -97,15 +98,15 @@ export function setup() {
|
||||||
for (const [status, counter] of Object.entries(obj_counters)) {
|
for (const [status, counter] of Object.entries(obj_counters)) {
|
||||||
const obj_selector = registry.getSelector(
|
const obj_selector = registry.getSelector(
|
||||||
__ENV.REGISTRY_FILE, status,
|
__ENV.REGISTRY_FILE, status,
|
||||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, { status });
|
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {status});
|
||||||
counter.add(obj_selector.count());
|
counter.add(obj_selector.count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleSummary(data) {
|
export function handleSummary(data) {
|
||||||
return {
|
return {
|
||||||
'stdout': textSummary(data, { indent: ' ', enableColors: false }),
|
'stdout' : textSummary(data, {indent : ' ', enableColors : false}),
|
||||||
[summary_json]: JSON.stringify(data),
|
[summary_json] : JSON.stringify(data),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,18 +138,18 @@ function verify_object_with_retries(obj, attempts) {
|
||||||
// ReferenceError: Cannot access a variable before initialization.
|
// ReferenceError: Cannot access a variable before initialization.
|
||||||
let lg = log;
|
let lg = log;
|
||||||
if (obj.c_id && obj.o_id) {
|
if (obj.c_id && obj.o_id) {
|
||||||
lg = lg.withFields({ cid: obj.c_id, oid: obj.o_id });
|
lg = lg.withFields({cid : obj.c_id, oid : obj.o_id});
|
||||||
result = grpc_client.verifyHash(obj.c_id, obj.o_id, obj.payload_hash);
|
result = grpc_client.verifyHash(obj.c_id, obj.o_id, obj.payload_hash);
|
||||||
} else if (obj.s3_bucket && obj.s3_key) {
|
} else if (obj.s3_bucket && obj.s3_key) {
|
||||||
lg = lg.withFields({ bucket: obj.s3_bucket, key: obj.s3_key });
|
lg = lg.withFields({bucket : obj.s3_bucket, key : obj.s3_key});
|
||||||
result =
|
result =
|
||||||
s3_client.verifyHash(obj.s3_bucket, obj.s3_key, obj.payload_hash);
|
s3_client.verifyHash(obj.s3_bucket, obj.s3_key, obj.payload_hash);
|
||||||
} else {
|
} else {
|
||||||
lg.withFields({
|
lg.withFields({
|
||||||
cid: obj.c_id,
|
cid : obj.c_id,
|
||||||
oid: obj.o_id,
|
oid : obj.o_id,
|
||||||
bucket: obj.s3_bucket,
|
bucket : obj.s3_bucket,
|
||||||
key: obj.s3_key
|
key : obj.s3_key
|
||||||
}).warn(`Object cannot be verified with supported protocols`);
|
}).warn(`Object cannot be verified with supported protocols`);
|
||||||
return 'skipped';
|
return 'skipped';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue