Skip to content

Commit

Permalink
Increase the timeout based on the multiplier
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
Mahesh Shetty authored and Mahesh Shetty committed Jan 6, 2025
1 parent fa7589e commit 0c70a93
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
25 changes: 18 additions & 7 deletions ocs_ci/helpers/mcg_stress_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def upload_objs_to_buckets(


def run_noobaa_metadata_intense_ops(
mcg_obj, pod_obj, bucket_factory, bucket, iteration_no, event=None
mcg_obj, pod_obj, bucket_factory, bucket, iteration_no, event=None, multiplier=1
):
"""
Perfrom metdata intense operations to stress Noobaa
Expand All @@ -123,6 +123,8 @@ def run_noobaa_metadata_intense_ops(
"""
bucket_type, bucket_obj = bucket
bucket_name = bucket_obj.name
base_timeout = 6000
timeout = base_timeout * multiplier

# Run metadata specific to bucket
def _run_bucket_ops():
Expand All @@ -132,7 +134,7 @@ def _run_bucket_ops():
stressing the noobaa db through lot of metadata related operations
"""

total_buckets_created = 0
while True:
buckets_created = list()
for i in range(0, 10):
Expand All @@ -156,6 +158,7 @@ def _run_bucket_ops():
bucket.delete()
logger.info(f"METADATA OP: Deleted bucket {bucket.name}")

total_buckets_created += len(buckets_created)
if event.is_set():
logger.info(
f"Successfully completed bucket creation/deletion operation in the background"
Expand All @@ -180,7 +183,7 @@ def _run_object_metadata_ops():
target=bucket_name,
prefix=iteration_no,
s3_obj=s3_obj,
timeout=12000,
timeout=timeout,
recursive=True,
)
while True:
Expand Down Expand Up @@ -259,7 +262,7 @@ def _run_noobaa_account_ops():
executor.shutdown()


def delete_objs_from_bucket(pod_obj, bucket, iteration_no, event=None):
def delete_objs_from_bucket(pod_obj, bucket, iteration_no, event=None, multiplier=1):
"""
Delete all the objects from a bucket
Expand All @@ -273,6 +276,9 @@ def delete_objs_from_bucket(pod_obj, bucket, iteration_no, event=None):
"""
bucket_type, bucket_obj = bucket
bucket_name = bucket_obj.name
base_timeout = 6000
timeout = base_timeout * multiplier

if bucket_type.upper() == "RGW":
mcg_obj = OBC(bucket_name)
else:
Expand All @@ -287,7 +293,7 @@ def delete_objs_from_bucket(pod_obj, bucket, iteration_no, event=None):
bucket_name,
mcg_obj,
prefix=iteration_no,
timeout=12000,
timeout=timeout,
)
logger.info(
f"Successfully completed object deletion operation on bucket {bucket_name} under prefix {iteration_no}"
Expand Down Expand Up @@ -327,7 +333,9 @@ def list_objs_from_bucket(bucket, iteration_no, event=None):
break


def download_objs_from_bucket(pod_obj, bucket, target_dir, iteration_no, event=None):
def download_objs_from_bucket(
pod_obj, bucket, target_dir, iteration_no, event=None, multiplier=1
):
"""
Download objects from a bucket back to local directory
Expand All @@ -342,6 +350,9 @@ def download_objs_from_bucket(pod_obj, bucket, target_dir, iteration_no, event=N
"""
bucket_type, bucket_obj = bucket
bucket_name = bucket_obj.name
base_timeout = 6000
timeout = base_timeout * multiplier

if bucket_type.upper() == "RGW":
mcg_obj = OBC(bucket_name)
else:
Expand All @@ -356,7 +367,7 @@ def download_objs_from_bucket(pod_obj, bucket, target_dir, iteration_no, event=N
f"s3://{bucket_name}/{iteration_no}",
target_dir,
mcg_obj,
timeout=12000,
timeout=timeout,
)
logger.info(
f"Downloaded objects from {bucket_name}/{iteration_no} to {target_dir}"
Expand Down
3 changes: 3 additions & 0 deletions tests/cross_functional/stress/test_noobaa_under_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_noobaa_under_stress(
bucket,
iteration_no=i,
event=event,
multiplier=multiplier,
)
)
buckets.remove(bucket)
Expand All @@ -137,6 +138,7 @@ def test_noobaa_under_stress(
bucket,
iteration_no=i,
event=event,
multiplier=multiplier,
)
)
buckets.remove(bucket)
Expand Down Expand Up @@ -165,6 +167,7 @@ def test_noobaa_under_stress(
stress_test_directory_setup.result_dir,
iteration_no=i,
event=event,
multiplier=multiplier,
)
)
buckets.remove(bucket)
Expand Down

0 comments on commit 0c70a93

Please sign in to comment.