forked from TrueCloudLab/xk6-frostfs
Add wallet params since -g flag is deprecated
Signed-off-by: Andrey Berezin <a.berezin@yadro.com> (cherry picked from commit 3120b9bd7d85b8170a14c153c08b956a31aa8c70)
This commit is contained in:
parent
23feb6c937
commit
d2541486ae
4 changed files with 28 additions and 14 deletions
|
@ -7,6 +7,8 @@ from helpers.neofs_cli import get_object
|
|||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--endpoint', help='Node address')
|
||||
parser.add_argument('--wallet', help='Wallet file path')
|
||||
parser.add_argument('--config', help='Wallet config file path')
|
||||
parser.add_argument('--preset_file', help='JSON file path with preset')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -21,11 +23,14 @@ def main():
|
|||
success_objs = 0
|
||||
failed_objs = 0
|
||||
|
||||
wallet = args.wallet
|
||||
wallet_config = args.config
|
||||
|
||||
for obj in preset.get('objects'):
|
||||
oid = obj.get('object')
|
||||
cid = obj.get('container')
|
||||
|
||||
rst = get_object(cid, oid, args.endpoint, "/dev/null")
|
||||
rst = get_object(cid, oid, args.endpoint, "/dev/null", wallet, wallet_config)
|
||||
|
||||
if rst:
|
||||
success_objs += 1
|
||||
|
|
|
@ -16,6 +16,8 @@ parser.add_argument('--expected_copies', help="Expected amount of object copies"
|
|||
parser.add_argument('--preset_file', help='JSON file path with preset')
|
||||
parser.add_argument('--max_workers', help='Max workers in parallel', default=50)
|
||||
parser.add_argument('--print_failed', help='Print failed objects', default=False)
|
||||
parser.add_argument('--wallet', help='Wallet file path')
|
||||
parser.add_argument('--config', help='Wallet config file path')
|
||||
|
||||
|
||||
args: Namespace = parser.parse_args()
|
||||
|
@ -35,12 +37,14 @@ def main():
|
|||
objs_len = len(objs)
|
||||
|
||||
endpoints = args.endpoints.split(',')
|
||||
wallet = args.wallet
|
||||
wallet_config = args.config
|
||||
|
||||
final_discrubution = Counter(dict.fromkeys(endpoints, 0))
|
||||
|
||||
with ProcessPoolExecutor(max_workers=50) as executor:
|
||||
search_runs = {executor.submit(check_object_amounts, obj.get('container'), obj.get('object'), endpoints,
|
||||
int(args.expected_copies)): obj for obj in objs}
|
||||
int(args.expected_copies), wallet, wallet_config): obj for obj in objs}
|
||||
|
||||
ProgressBar.start()
|
||||
|
||||
|
@ -64,13 +68,13 @@ def main():
|
|||
print(f'{endpoint}: {final_discrubution[endpoint]}')
|
||||
|
||||
|
||||
def check_object_amounts(cid, oid, endpoints, expected_copies):
|
||||
def check_object_amounts(cid, oid, endpoints, expected_copies, wallet, wallet_config):
|
||||
distribution = Counter(dict.fromkeys(endpoints, 0))
|
||||
|
||||
copies_in_cluster = 0
|
||||
|
||||
for endpoint in endpoints:
|
||||
copy_on_endpoint = search_object_by_id(cid, oid, endpoint, ttl=1)
|
||||
copy_on_endpoint = search_object_by_id(cid, oid, endpoint, wallet, wallet_config, ttl=1)
|
||||
|
||||
copies_in_cluster += int(copy_on_endpoint)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import re
|
|||
from helpers.cmd import execute_cmd
|
||||
|
||||
|
||||
def create_container(endpoint, policy):
|
||||
cmd_line = f"neofs-cli --rpc-endpoint {endpoint} container create -g" \
|
||||
def create_container(endpoint, policy, wallet_file, wallet_config):
|
||||
cmd_line = f"neofs-cli --rpc-endpoint {endpoint} container create --wallet {wallet_file} --config {wallet_config} " \
|
||||
f" --policy '{policy}' --basic-acl public-read-write --await"
|
||||
|
||||
output, success = execute_cmd(cmd_line)
|
||||
|
@ -27,9 +27,9 @@ def create_container(endpoint, policy):
|
|||
return splitted[1]
|
||||
|
||||
|
||||
def upload_object(container, payload_filepath, endpoint):
|
||||
def upload_object(container, payload_filepath, endpoint, wallet_file, wallet_config):
|
||||
object_name = ""
|
||||
cmd_line = f"neofs-cli --rpc-endpoint {endpoint} object put -g --file {payload_filepath} " \
|
||||
cmd_line = f"neofs-cli --rpc-endpoint {endpoint} object put --file {payload_filepath} --wallet {wallet_file} --config {wallet_config} " \
|
||||
f"--cid {container} --no-progress"
|
||||
output, success = execute_cmd(cmd_line)
|
||||
|
||||
|
@ -49,8 +49,8 @@ def upload_object(container, payload_filepath, endpoint):
|
|||
return splitted[1]
|
||||
|
||||
|
||||
def get_object(cid, oid, endpoint, out_filepath):
|
||||
cmd_line = f"neofs-cli object get -r {endpoint} -g --cid {cid} --oid {oid} " \
|
||||
def get_object(cid, oid, endpoint, out_filepath, wallet_file, wallet_config):
|
||||
cmd_line = f"neofs-cli object get -r {endpoint} --cid {cid} --oid {oid} --wallet {wallet_file} --config {wallet_config} " \
|
||||
f"--file {out_filepath}"
|
||||
|
||||
output, success = execute_cmd(cmd_line)
|
||||
|
@ -63,8 +63,8 @@ def get_object(cid, oid, endpoint, out_filepath):
|
|||
return True
|
||||
|
||||
|
||||
def search_object_by_id(cid, oid, endpoint, ttl=2):
|
||||
cmd_line = f"neofs-cli object search --ttl {ttl} -r {endpoint} -g --cid {cid} --oid {oid}"
|
||||
def search_object_by_id(cid, oid, endpoint, wallet_file, wallet_config, ttl=2):
|
||||
cmd_line = f"neofs-cli object search --ttl {ttl} -r {endpoint} --cid {cid} --oid {oid} --wallet {wallet_file} --config {wallet_config} "
|
||||
|
||||
output, success = execute_cmd(cmd_line)
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ parser.add_argument('--size', help='Upload objects size in kb')
|
|||
parser.add_argument('--containers', help='Number of containers to create')
|
||||
parser.add_argument('--out', help='JSON file with output')
|
||||
parser.add_argument('--preload_obj', help='Number of pre-loaded objects')
|
||||
parser.add_argument('--wallet', help='Wallet file path')
|
||||
parser.add_argument('--config', help='Wallet config file path')
|
||||
parser.add_argument(
|
||||
"--policy",
|
||||
help="Container placement policy",
|
||||
|
@ -34,6 +36,9 @@ def main():
|
|||
|
||||
endpoints = args.endpoint.split(',')
|
||||
|
||||
wallet = args.wallet
|
||||
wallet_config = args.config
|
||||
|
||||
if args.update:
|
||||
# Open file
|
||||
with open(args.out) as f:
|
||||
|
@ -43,7 +48,7 @@ def main():
|
|||
print(f"Create containers: {args.containers}")
|
||||
with ProcessPoolExecutor(max_workers=50) as executor:
|
||||
containers_runs = {executor.submit(create_container, endpoints[random.randrange(len(endpoints))],
|
||||
args.policy): _ for _ in range(int(args.containers))}
|
||||
args.policy, wallet, wallet_config): _ for _ in range(int(args.containers))}
|
||||
|
||||
for run in containers_runs:
|
||||
if run.result():
|
||||
|
@ -63,7 +68,7 @@ def main():
|
|||
print(f" > Upload objects for container {container}")
|
||||
with ProcessPoolExecutor(max_workers=50) as executor:
|
||||
objects_runs = {executor.submit(upload_object, container, payload_filepath,
|
||||
endpoints[random.randrange(len(endpoints))]): _ for _ in range(int(args.preload_obj))}
|
||||
endpoints[random.randrange(len(endpoints))], wallet, wallet_config): _ for _ in range(int(args.preload_obj))}
|
||||
|
||||
for run in objects_runs:
|
||||
if run.result():
|
||||
|
|
Loading…
Reference in a new issue