Skip to content

Commit

Permalink
lib: use random values for ranges, closes #632 (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-khimov authored Sep 27, 2023
2 parents 2e03e02 + 9be6b6b commit 9e9e2ca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions robot/resources/lib/python_keywords/object_access.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import random
from typing import Optional

import allure
Expand Down Expand Up @@ -142,6 +143,13 @@ def can_get_head_object(
return True


def _generate_random_range_cut(offset: int = 0, length: int = 10):
# [X:0] requests are not allowed
offset = random.randint(offset, length-1)
length = length - random.randint(offset, length-1)
return f"{offset}:{length}"


def can_get_range_of_object(
wallet: str,
cid: str,
Expand All @@ -159,7 +167,7 @@ def can_get_range_of_object(
cid,
oid,
bearer=bearer,
range_cut="0:10",
range_cut=_generate_random_range_cut(),
wallet_config=wallet_config,
xhdr=xhdr,
shell=shell,
Expand Down Expand Up @@ -190,7 +198,7 @@ def can_get_range_hash_of_object(
cid,
oid,
bearer=bearer,
range_cut="0:10",
range_cut=_generate_random_range_cut(),
wallet_config=wallet_config,
xhdr=xhdr,
shell=shell,
Expand Down

0 comments on commit 9e9e2ca

Please sign in to comment.