Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
Signed-off-by: Tullio Sebastiani <[email protected]>

lint

Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani authored and chaitanyaenr committed Jul 16, 2024
1 parent 7fb464f commit d51918e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/krkn_lib/k8s/krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1935,10 +1935,10 @@ def get_kubernetes_core_objects_count(
query_params: List[str] = []
header_params: Dict[str, str] = {}
auth_settings = ["BearerToken"]
header_params[
"Accept"
] = api_client.select_header_accept(
["application/json"]
header_params["Accept"] = (
api_client.select_header_accept(
["application/json"]
)
)

path = f"/api/{api_version}/{resource.name}"
Expand Down Expand Up @@ -2962,7 +2962,9 @@ def __monitor_pods_worker(
# sum the time elapsed waiting before the pod
# has been rescheduled (rescheduling time)
# to the effective recovery time of the pod
result.pod_rescheduling_time = time.time() - start_time - result.pod_readiness_time
result.pod_rescheduling_time = (
time.time() - start_time - result.pod_readiness_time
)
result.total_recovery_time = (
result.pod_readiness_time
+ result.pod_rescheduling_time
Expand Down Expand Up @@ -3054,10 +3056,10 @@ def replace_service_selector(
header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
header_params[
"Content-Type"
] = self.api_client.select_header_accept(
["application/json-patch+json"]
header_params["Content-Type"] = (
self.api_client.select_header_accept(
["application/json-patch+json"]
)
)

path = (
Expand Down
6 changes: 6 additions & 0 deletions src/krkn_lib/tests/test_krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,12 @@ def test_monitor_pods_by_label_no_pods_affected(self):
self.deploy_delayed_readiness_pod(delayed_1, namespace, 0, label)
self.deploy_delayed_readiness_pod(delayed_2, namespace, 0, label)

while not self.lib_k8s.is_pod_running(delayed_1, namespace) or (
not self.lib_k8s.is_pod_running(delayed_2, namespace)
):
time.sleep(1)
continue

monitor_timeout = 2
pods_and_namespaces = self.lib_k8s.select_pods_by_label(
f"test={label}"
Expand Down

0 comments on commit d51918e

Please sign in to comment.