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
|
||||
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:
|
||||
name: Tests
|
||||
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 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
|
||||
format:
|
||||
@echo "⇒ Processing gofmt check"
|
||||
@gofmt -s -w ./
|
||||
@echo "⇒ Processing clang format"
|
||||
@clang-format -i **/*.js
|
||||
|
||||
# Run linters
|
||||
lint:
|
||||
|
|
|
@ -57,7 +57,7 @@ const frostfs_cli = native.connect("s01.frostfs.devenv:8080", "", 0, 0, false, 0
|
|||
|
||||
### Methods
|
||||
- `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`
|
||||
boolean flag, `container_id` string, and `error` string.
|
||||
- `setBufferSize(size)`. Sets internal buffer size for data upload and
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import local from 'k6/x/frostfs/local';
|
||||
|
||||
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||
|
||||
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 = {
|
||||
stages : [
|
||||
|
@ -14,11 +16,13 @@ export default function () {
|
|||
let headers = {
|
||||
'unique_header' : uuidv4()
|
||||
}
|
||||
|
||||
const container_id = '6BVPPXQewRJ6J5EYmAPLczXxNocS7ikyF7amS2esWQnb';
|
||||
let resp = local_cli.put(container_id, headers, payload)
|
||||
if (resp.success) {
|
||||
local_cli.get(container_id, resp.object_id)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
console.log(resp.error)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import native from 'k6/x/frostfs/native';
|
||||
import {fail} from "k6";
|
||||
import native from 'k6/x/frostfs/native';
|
||||
|
||||
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)
|
||||
const frostfs_cli = native.connect(
|
||||
"s01.frostfs.devenv:8080",
|
||||
"1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb", 0, 0,
|
||||
false, 0)
|
||||
|
||||
export const options = {
|
||||
stages : [
|
||||
|
@ -13,6 +17,7 @@ export const options = {
|
|||
|
||||
export function setup() {
|
||||
const params = {
|
||||
acl : 'public-read-write',
|
||||
placement_policy : 'REP 3',
|
||||
name : 'container-name',
|
||||
name_global_scope : 'false'
|
||||
|
@ -27,13 +32,12 @@ export function setup() {
|
|||
}
|
||||
|
||||
export default function(data) {
|
||||
let headers = {
|
||||
'unique_header': uuidv4()
|
||||
}
|
||||
let resp = frostfs_cli.put(data.container_id, headers, payload)
|
||||
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 {
|
||||
}
|
||||
else {
|
||||
console.log(resp.error)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import native from 'k6/x/frostfs/native';
|
||||
|
||||
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||
|
||||
const payload = open('../go.sum', 'b');
|
||||
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)
|
||||
|
||||
export const options = {
|
||||
|
@ -13,13 +15,13 @@ export const options = {
|
|||
};
|
||||
|
||||
export default function() {
|
||||
let headers = {
|
||||
'unique_header': uuidv4()
|
||||
}
|
||||
let headers = {'unique_header' : uuidv4()}
|
||||
|
||||
let resp = frostfs_obj.put(headers)
|
||||
if (resp.success) {
|
||||
frostfs_cli.get(container, resp.object_id)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
console.log(resp.error)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import s3 from 'k6/x/frostfs/s3';
|
||||
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'})
|
||||
const s3_cli =
|
||||
s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl' : 'true'})
|
||||
|
||||
export const options = {
|
||||
stages : [
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import s3local from 'k6/x/frostfs/s3local';
|
||||
|
||||
import {uuidv4} from '../scenarios/libs/k6-utils-1.4.0.js';
|
||||
|
||||
const bucket = "testbucket"
|
||||
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(
|
||||
"path/to/storage/config.yml", "path/to/storage/config/dir", {}, {
|
||||
'testbucket' : 'GBQDDUM1hdodXmiRHV57EUkFWJzuntsG8BG15wFSwam6',
|
||||
});
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||
"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"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
"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())
|
||||
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"]
|
||||
if ok {
|
||||
var placementPolicy netmap.PlacementPolicy
|
||||
|
|
|
@ -31,7 +31,8 @@ const grpc_endpoint =
|
|||
const grpc_client = native.connect(
|
||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||
__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'));
|
||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ import { uuidv4 } from './libs/k6-utils-1.4.0.js';
|
|||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function () {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function () {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -30,7 +30,8 @@ const grpc_endpoint =
|
|||
const grpc_client = native.connect(
|
||||
grpc_endpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_TIMEOUT) : 5,
|
||||
__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'));
|
||||
const log = logging.new().withField('endpoint', grpc_endpoint);
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
|||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -137,7 +137,8 @@ export function obj_read() {
|
|||
const resp =
|
||||
http.get(`http://${http_endpoint}/get/${obj.container}/${obj.object}`);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
|||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
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):
|
||||
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}"
|
||||
if 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} " \
|
||||
f" --policy '{policy}' --await"
|
||||
f" --policy '{policy}' {acl_param} --await"
|
||||
|
||||
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)
|
||||
|
||||
# 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:
|
||||
return cid
|
||||
|
||||
|
@ -100,7 +88,7 @@ def create_container(endpoint, policy, container_creation_retry, wallet_path, co
|
|||
return cid
|
||||
|
||||
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):
|
||||
|
|
|
@ -16,7 +16,6 @@ ERROR_WRONG_CONTAINERS_COUNT = 1
|
|||
ERROR_WRONG_OBJECTS_COUNT = 2
|
||||
MAX_WORKERS = 50
|
||||
DEFAULT_POLICY = "REP 2 IN X CBF 2 SELECT 2 FROM * AS X"
|
||||
DEFAULT_RULES = ["allow Object.* *"]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
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), '
|
||||
'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(
|
||||
'--rule',
|
||||
help='Rule attached to created containers. All entries of CONTAINER_ID will be replaced with id of created container.',
|
||||
action="append")
|
||||
parser.add_argument('--acl', help='Container ACL. Default is public-read-write.', default='public-read-write')
|
||||
|
||||
args: Namespace = parser.parse_args()
|
||||
print(args)
|
||||
|
@ -60,9 +56,6 @@ def main():
|
|||
wallet_config = args.config
|
||||
workers = int(args.workers)
|
||||
objects_per_container = int(args.preload_obj)
|
||||
rules = args.rule
|
||||
if not rules:
|
||||
rules = DEFAULT_RULES
|
||||
|
||||
ignore_errors = args.ignore_errors
|
||||
if args.update:
|
||||
|
@ -75,7 +68,7 @@ def main():
|
|||
containers_count = int(args.containers)
|
||||
print(f"Create containers: {containers_count}")
|
||||
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
|
||||
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 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 {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {newGenerator} from './libs/datagen.js';
|
||||
import {generateS3Key} from './libs/keygen.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ import registry from 'k6/x/frostfs/registry';
|
|||
import s3 from 'k6/x/frostfs/s3';
|
||||
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 {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {generateS3Key} from './libs/keygen.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const bucket_list = new SharedArray('bucket_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
||||
});
|
||||
const bucket_list = new SharedArray(
|
||||
'bucket_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||
|
||||
const read_size = JSON.parse(open(__ENV.PREGEN_JSON)).obj_size;
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
@ -86,7 +86,6 @@ if (write_rate > 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 read_rate = parseInt(__ENV.READ_RATE || '0');
|
||||
|
@ -103,7 +102,6 @@ if (read_rate > 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 delete_rate = parseInt(__ENV.DELETE_RATE || '0');
|
||||
|
|
|
@ -6,10 +6,10 @@ import registry from 'k6/x/frostfs/registry';
|
|||
import s3 from 'k6/x/frostfs/s3';
|
||||
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 {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {generateS3Key} from './libs/keygen.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
|
@ -100,8 +100,6 @@ if (registry_enabled ) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
const delete_vu_count = parseInt(__ENV.DELETERS || '0');
|
||||
if (delete_vu_count > 0) {
|
||||
if (!obj_to_delete_selector) {
|
||||
|
@ -186,9 +184,15 @@ export function obj_read() {
|
|||
}
|
||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||
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);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
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 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 {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {generateS3Key} from './libs/keygen.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
const bucket_list = new SharedArray('bucket_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
||||
});
|
||||
const bucket_list = new SharedArray(
|
||||
'bucket_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||
|
||||
const summary_json = __ENV.SUMMARY_JSON || '/tmp/summary.json';
|
||||
|
||||
|
@ -105,9 +105,8 @@ export function obj_write_multipart() {
|
|||
const bucket = bucket_list[Math.floor(Math.random() * bucket_list.length)];
|
||||
|
||||
const payload = generator.genPayload();
|
||||
const resp = s3_client.multipart(
|
||||
bucket, key, write_multipart_part_size, write_multipart_vu_count,
|
||||
payload);
|
||||
const resp = s3_client.multipart(bucket, key, write_multipart_part_size,
|
||||
write_multipart_vu_count, payload);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||
return;
|
||||
|
|
|
@ -5,25 +5,25 @@ import registry from 'k6/x/frostfs/registry';
|
|||
import s3local from 'k6/x/frostfs/s3local';
|
||||
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 {textSummary} from './libs/k6-summary-0.0.2.js';
|
||||
import {uuidv4} from './libs/k6-utils-1.4.0.js';
|
||||
import {generateS3Key} from './libs/keygen.js';
|
||||
|
||||
parseEnv();
|
||||
|
||||
const obj_list = new SharedArray('obj_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).objects;
|
||||
});
|
||||
const obj_list = new SharedArray(
|
||||
'obj_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).objects; });
|
||||
|
||||
const container_list = new SharedArray('container_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).containers;
|
||||
});
|
||||
const container_list = new SharedArray(
|
||||
'container_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).containers; });
|
||||
|
||||
const bucket_list = new SharedArray('bucket_list', function() {
|
||||
return JSON.parse(open(__ENV.PREGEN_JSON)).buckets;
|
||||
});
|
||||
const bucket_list = new SharedArray(
|
||||
'bucket_list',
|
||||
function() { return JSON.parse(open(__ENV.PREGEN_JSON)).buckets; });
|
||||
|
||||
function bucket_mapping() {
|
||||
if (container_list.length != bucket_list.length) {
|
||||
|
@ -43,8 +43,7 @@ const config_file = __ENV.CONFIG_FILE;
|
|||
const config_dir = __ENV.CONFIG_DIR;
|
||||
const max_total_size_gb =
|
||||
__ENV.MAX_TOTAL_SIZE_GB ? parseInt(__ENV.MAX_TOTAL_SIZE_GB) : 0;
|
||||
const s3_client = s3local.connect(
|
||||
config_file, config_dir, {
|
||||
const s3_client = s3local.connect(config_file, config_dir, {
|
||||
'debug_logger' : __ENV.DEBUG_LOGGER || 'false',
|
||||
},
|
||||
bucket_mapping(), max_total_size_gb);
|
||||
|
|
|
@ -44,7 +44,8 @@ if (__ENV.GRPC_ENDPOINTS) {
|
|||
grpc_client = native.connect(
|
||||
grpcEndpoint, '', __ENV.DIAL_TIMEOUT ? parseInt(__ENV.DIAL_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'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue