forked from TrueCloudLab/frostfs-testlib
36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
import logging
|
|
|
|
from frostfs_testlib.load.load_config import LoadParams, LoadScenario
|
|
from frostfs_testlib.load.load_metrics import get_metrics_object
|
|
|
|
logger = logging.getLogger("NeoLogger")
|
|
|
|
|
|
class LoadVerifier:
|
|
def __init__(self, load_params: LoadParams) -> None:
|
|
self.load_params = load_params
|
|
|
|
def verify_summaries(self, load_summary, verification_summary) -> None:
|
|
if not verification_summary or not load_summary:
|
|
logger.info("Can't check load results due to missing summary")
|
|
|
|
load_metrics = get_metrics_object(self.load_params.scenario, load_summary)
|
|
writers = self.load_params.writers or 0
|
|
|
|
objects_count = load_metrics.write_success_iterations
|
|
fails_count = load_metrics.write_failed_iterations
|
|
|
|
if writers > 0:
|
|
assert objects_count > 0, "Total put objects should be greater than 0"
|
|
assert fails_count == 0, f"There were {fails_count} failed put objects operations"
|
|
|
|
if verification_summary:
|
|
verify_metrics = get_metrics_object(LoadScenario.VERIFY, verification_summary)
|
|
verified_objects = verify_metrics.read_success_iterations
|
|
invalid_objects = verify_metrics.read_failed_iterations
|
|
|
|
assert invalid_objects == 0, f"There were {invalid_objects} verification fails"
|
|
# Due to interruptions we may see total verified objects to be less than written on writers count
|
|
assert (
|
|
abs(objects_count - verified_objects) <= writers
|
|
), f"Verified objects is less than total objects. Total: {objects_count}, Verified: {verified_objects}. Writers: {writers}."
|