forked from TrueCloudLab/frostfs-testlib
Move shared code to testlib
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
d97a02d1d3
commit
997e768e92
69 changed files with 9213 additions and 64 deletions
36
src/frostfs_testlib/load/load_verifiers.py
Normal file
36
src/frostfs_testlib/load/load_verifiers.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
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}."
|
Loading…
Add table
Add a link
Reference in a new issue