Skip to content

Commit

Permalink
test-api: fixup v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Gierszewski committed Sep 3, 2024
1 parent c67e393 commit a1eb1b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
19 changes: 10 additions & 9 deletions test/functional/api/cas/cache_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ def __str__(self):
class FlushParametersAlru:
def __init__(
self,
activity_threshold=None,
flush_max_buffers=None,
staleness_time=None,
wake_up_time=None,
activity_threshold: Time = None,
flush_max_buffers: int = None,
staleness_time: Time = None,
wake_up_time: Time = None,
):
self.activity_threshold = activity_threshold
self.flush_max_buffers = flush_max_buffers
Expand Down Expand Up @@ -216,7 +216,8 @@ def default_acp_params():


class SeqCutOffParameters:
def __init__(self, policy=None, threshold=None, promotion_count=None):
def __init__(self, policy: CleaningPolicy = None, threshold: Size = None, promotion_count: int
= None):
self.policy = policy
self.threshold = threshold
self.promotion_count = promotion_count
Expand All @@ -238,7 +239,7 @@ def default_seq_cut_off_params():


class PromotionParametersNhit:
def __init__(self, threshold=None, trigger=None):
def __init__(self, threshold: Size = None, trigger: int = None):
self.threshold = threshold
self.trigger = trigger

Expand Down Expand Up @@ -365,9 +366,9 @@ def get_parameter_dictionary(self):
class CacheConfig:
def __init__(
self,
cache_line_size=CacheLineSize.DEFAULT,
cache_mode=CacheMode.DEFAULT,
cleaning_policy=CleaningPolicy.DEFAULT,
cache_line_size: CacheLineSize = CacheLineSize.DEFAULT,
cache_mode: CacheMode = CacheMode.DEFAULT,
cleaning_policy: CleaningPolicy = CleaningPolicy.DEFAULT,
kernel_parameters=None,
):
self.cache_line_size = cache_line_size
Expand Down
16 changes: 12 additions & 4 deletions test/functional/api/cas/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#

import csv
from enum import Enum

from enum import Enum
from datetime import timedelta
from typing import List

Expand All @@ -28,6 +28,14 @@ def __str__(self):
return self.value


class OperationType(Enum):
read = "Read"
write = "Write"

def __str__(self):
return self.value


class CacheStats:
def __init__(
self,
Expand Down Expand Up @@ -467,10 +475,10 @@ class RequestStats:
def __init__(self, stats_dict, percentage_val):
unit = UnitType.percentage if percentage_val else UnitType.requests
self.read = RequestStatsChunk(
stats_dict=stats_dict, percentage_val=percentage_val, operation="Read"
stats_dict=stats_dict, percentage_val=percentage_val, operation=OperationType.read
)
self.write = RequestStatsChunk(
stats_dict=stats_dict, percentage_val=percentage_val, operation="Write"
stats_dict=stats_dict, percentage_val=percentage_val, operation=OperationType.write
)
self.pass_through_reads = parse_value(
value=stats_dict[f"Pass-Through reads {unit}"], unit_type=unit
Expand Down Expand Up @@ -510,7 +518,7 @@ def __eq__(self, other):


class RequestStatsChunk:
def __init__(self, stats_dict, percentage_val, operation: str):
def __init__(self, stats_dict, percentage_val: bool, operation: OperationType):
unit = UnitType.percentage if percentage_val else UnitType.requests
self.hits = parse_value(value=stats_dict[f"{operation} hits {unit}"], unit_type=unit)
self.part_misses = parse_value(
Expand Down

0 comments on commit a1eb1b4

Please sign in to comment.