benchmark-runner 1.0.693__py3-none-any.whl → 1.0.695__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -379,22 +379,28 @@ class OC(SSH):
379
379
  def wait_for_odf_healthcheck(self, pod_name: str, namespace: str,
380
380
  timeout: int = int(environment_variables.environment_variables_dict['timeout'])):
381
381
  """
382
- This method waits for patch, needs to wait that pod is created and then wait for ready
383
- @param pod_name:
384
- @param namespace:
385
- @param timeout:
386
- @return:
382
+ This method waits for the ODF health check by ensuring the pod is created and reaches the 'HEALTH_OK' status.
383
+
384
+ @param pod_name: Name of the pod to check health.
385
+ @param namespace: Namespace where the pod is located.
386
+ @param timeout: Timeout in seconds for waiting. If set to 0 or negative, wait indefinitely.
387
+ @return: True if health check passes within the timeout.
388
+ @raise ODFHealthCheckTimeout: If health check fails within the timeout.
387
389
  """
388
390
  current_wait_time = 0
389
391
  health_check = f"{self.__cli} -n {namespace} rsh {self._get_pod_name(pod_name=pod_name, namespace=namespace)} ceph health"
390
- while timeout <= 0 or current_wait_time <= timeout and 'HEALTH_OK' != self.run(health_check).strip():
391
- # sleep for x seconds
392
+
393
+ while timeout <= 0 or current_wait_time <= timeout:
394
+ if 'HEALTH_OK' == self.run(health_check).strip():
395
+ return True
396
+
397
+ # Sleep for a defined interval and update the wait time
392
398
  time.sleep(OC.SLEEP_TIME)
393
399
  current_wait_time += OC.SLEEP_TIME
394
- if 'HEALTH_OK' == self.run(health_check).strip():
395
- return True
396
- else:
397
- raise ODFHealthCheckTimeout()
400
+
401
+ # Raise exception if health check fails within the timeout
402
+ raise ODFHealthCheckTimeout(
403
+ message=f"Health check failed for pod '{pod_name}' in namespace '{namespace}' after {timeout} seconds.")
398
404
 
399
405
  @typechecked
400
406
  @logger_time_stamp
@@ -471,7 +477,7 @@ class OC(SSH):
471
477
  wait_time = wait_time or OC.SHORT_TIMEOUT
472
478
  nodes_status = None
473
479
  current_wait_time = 0
474
- while timeout <= 0 or current_wait_time < timeout:
480
+ while timeout <= 0 or current_wait_time <= timeout:
475
481
  nodes_status = self.check_node_status(node=node)
476
482
  if nodes_status is True:
477
483
  return True
@@ -161,8 +161,8 @@ class OperatorUpgradeTimeout(OCError):
161
161
 
162
162
  class ODFHealthCheckTimeout(OCError):
163
163
  """This exception return odf healthcheck timeout error"""
164
- def __init__(self):
165
- self.message = f"ODF health check timeout"
164
+ def __init__(self, message: str):
165
+ self.message = message
166
166
  super(ODFHealthCheckTimeout, self).__init__(self.message)
167
167
 
168
168
 
@@ -0,0 +1,43 @@
1
+
2
+ import os
3
+
4
+ from benchmark_runner.common.oc.oc import OC
5
+ from benchmark_runner.common.logger.logger_time_stamp import logger_time_stamp, logger
6
+ from benchmark_runner.common.ocp_resources.create_ocp_resource_operations import CreateOCPResourceOperations
7
+
8
+
9
+ class CreateNHCSNR(CreateOCPResourceOperations):
10
+ """
11
+ This class is created node-health-check and self-node-remediation operators
12
+ """
13
+ def __init__(self, oc: OC, path: str, resource_list: list):
14
+ super().__init__(oc)
15
+ self.__oc = oc
16
+ self.__path = path
17
+ self.__resource_list = resource_list
18
+
19
+ @logger_time_stamp
20
+ def create_nhc_snr(self):
21
+ """
22
+ This method creates node-health-check and self-node-remediation operators
23
+ :return:
24
+ """
25
+ for resource in self.__resource_list:
26
+ logger.info(f'run {resource}')
27
+ self.__oc.create_async(yaml=os.path.join(self.__path, resource))
28
+
29
+ if '03_subscription.yaml' in resource:
30
+ # verify once after create all resource files
31
+ self.wait_for_ocp_resource_create(operator='nhc',
32
+ verify_cmd="oc get csv -n openshift-workload-availability -o jsonpath='{.items[0].status.phase}'",
33
+ status='Succeeded')
34
+ self.wait_for_ocp_resource_create(operator='snr',
35
+ verify_cmd="oc get csv -n openshift-workload-availability -o jsonpath='{.items[1].status.phase}'",
36
+ status='Succeeded')
37
+ # SNR is automatically enabled when NHC is enabled
38
+ if '04_nhc_snr.yaml' in resource:
39
+ # Verify NHC is enabled
40
+ self.wait_for_ocp_resource_create(operator='nhc',
41
+ verify_cmd="oc get nhc -A -o jsonpath='{range .items[*]}{.status.phase}{\"\\n\"}{end}'",
42
+ status='Enabled')
43
+ return True
@@ -8,6 +8,7 @@ from benchmark_runner.common.ocp_resources.create_lso import CreateLSO
8
8
  from benchmark_runner.common.ocp_resources.create_odf import CreateODF
9
9
  from benchmark_runner.common.ocp_resources.create_kata import CreateKata
10
10
  from benchmark_runner.common.ocp_resources.create_cnv import CreateCNV
11
+ from benchmark_runner.common.ocp_resources.create_nhc_snr import CreateNHCSNR
11
12
  from benchmark_runner.common.ocp_resources.create_custom import CreateCustom
12
13
  from benchmark_runner.common.ocp_resources.migrate_infra import MigrateInfra
13
14
 
@@ -91,6 +92,9 @@ class CreateOCPResource:
91
92
  elif 'cnv' == resource:
92
93
  create_cnv = CreateCNV(self.__oc, path=os.path.join(self.__dir_path, resource), resource_list=resource_files)
93
94
  create_cnv.create_cnv()
95
+ elif 'nhc_snr' == resource:
96
+ create_nhc_snr = CreateNHCSNR(self.__oc, path=os.path.join(self.__dir_path, resource), resource_list=resource_files)
97
+ create_nhc_snr.create_nhc_snr()
94
98
  elif 'infra' == resource:
95
99
  create_infra = MigrateInfra(self.__oc, path=os.path.join(self.__dir_path, resource), resource_list=resource_files)
96
100
  create_infra.migrate_infra()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: benchmark-runner
3
- Version: 1.0.693
3
+ Version: 1.0.695
4
4
  Summary: Benchmark Runner Tool
5
5
  Home-page: https://github.com/redhat-performance/benchmark-runner
6
6
  Author: Red Hat
@@ -46,14 +46,15 @@ benchmark_runner/common/logger/init_logger.py,sha256=ERa-gNqrl2pZybj7v3csvmao7Mv
46
46
  benchmark_runner/common/logger/logger_exceptions.py,sha256=rivdlRm_jIsKQ53rP_-HX8emdtOmQNO4JuIkg8fnBoc,454
47
47
  benchmark_runner/common/logger/logger_time_stamp.py,sha256=2JgugN9LpXF4Ijx0wPRzz3DAGJB8eJpM5g1qPvbWbV8,1479
48
48
  benchmark_runner/common/oc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
- benchmark_runner/common/oc/oc.py,sha256=Z_XGh_PJzKfN7kfSwhoCJs7ZofynPaziN20nNKLHUBM,66236
50
- benchmark_runner/common/oc/oc_exceptions.py,sha256=Hj0IIjIbLkKnfhErynpAIzupdsU-eerndwQBPoNWShs,6342
49
+ benchmark_runner/common/oc/oc.py,sha256=VfD-IQRjRT5-nhkCi1zH9rhY6giOywQJw2oIkgf6GZM,66694
50
+ benchmark_runner/common/oc/oc_exceptions.py,sha256=4JDebyFqe6yIN6Y70E-oscWnme0t7Ggg_CJBBoOuFPs,6336
51
51
  benchmark_runner/common/ocp_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  benchmark_runner/common/ocp_resources/create_cnv.py,sha256=AXsyR8_g_RIFHz2rkyHzzvvUDIiGdOi9rZWJPhiPzDQ,3511
53
53
  benchmark_runner/common/ocp_resources/create_custom.py,sha256=rthm96yDzI-Hke54hLWTs0O3gDtpQPR6n184ehaEevo,1029
54
54
  benchmark_runner/common/ocp_resources/create_kata.py,sha256=IhfnDHj0lLUVENA-Nh9BucSAt0BqL8mtqT6QloMzIDg,3721
55
55
  benchmark_runner/common/ocp_resources/create_lso.py,sha256=anrLu2NymdxE7LkJ9fytqmhkysq7hVLOYBVxjfFlmVE,1634
56
- benchmark_runner/common/ocp_resources/create_ocp_resource.py,sha256=iBiT5CfuaYuDfX5zc64IzZhQKGrGHzVSLK9eyJmjDkk,5217
56
+ benchmark_runner/common/ocp_resources/create_nhc_snr.py,sha256=pTyx6Y5BNfXvRtJcbfLtUlqdEb1eB7ypCFv9-kBEIuU,2057
57
+ benchmark_runner/common/ocp_resources/create_ocp_resource.py,sha256=ik0lotwiuECRDCbPYfDpi2Q_qjhtc2XDCR9zbY_Z9V0,5504
57
58
  benchmark_runner/common/ocp_resources/create_ocp_resource_exceptions.py,sha256=hthowyHAeg66IZHYPe1FWU3dnhwXcQtPBrOQSO1RZMU,941
58
59
  benchmark_runner/common/ocp_resources/create_ocp_resource_operations.py,sha256=47SyVjtv5e9vKuRQFlC-VfGKXBLEl46rut4XVeZRsMo,6834
59
60
  benchmark_runner/common/ocp_resources/create_odf.py,sha256=3ZwFaiLB-j062W-6SESZRzh6thUrn1dAzDQ07FISOjE,4441
@@ -165,8 +166,8 @@ benchmark_runner/workloads/windows_vm.py,sha256=eHK79ueAkSlNC1uamz19o7CO20wzJi-U
165
166
  benchmark_runner/workloads/workloads.py,sha256=F9fnk4h715tq7ANSCbDH0jktB8fpr_u3YG61Kdi5_os,1422
166
167
  benchmark_runner/workloads/workloads_exceptions.py,sha256=u7VII95iPRF_YhfpGH1U1RmgiIYESMOtbSF1dz7_ToE,1858
167
168
  benchmark_runner/workloads/workloads_operations.py,sha256=tAgvdMRMu5Ybck81UBCBE6H76PN0L2GptjNRnYoFv2M,25221
168
- benchmark_runner-1.0.693.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
169
- benchmark_runner-1.0.693.dist-info/METADATA,sha256=05rM5Gt5Prd1es2pxpYcHYzYd4SpH4RTSRqvPwj599E,11309
170
- benchmark_runner-1.0.693.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
171
- benchmark_runner-1.0.693.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
172
- benchmark_runner-1.0.693.dist-info/RECORD,,
169
+ benchmark_runner-1.0.695.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
170
+ benchmark_runner-1.0.695.dist-info/METADATA,sha256=1wql7Qer_yLnmASjjKhTqjNzbvG7-LB7AQ2eu3NU1cc,11309
171
+ benchmark_runner-1.0.695.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
172
+ benchmark_runner-1.0.695.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
173
+ benchmark_runner-1.0.695.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.4.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5