Skip to content

Commit

Permalink
Added backof to dns health probe
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Smolar committed Dec 21, 2023
1 parent c05ddef commit 70ebdd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions testsuite/policy/dns_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from dataclasses import dataclass
from typing import Optional, Literal

import backoff
import openshift as oc
from openshift import OpenShiftPythonException

from testsuite.utils import asdict
from testsuite.gateway import Referencable
Expand Down Expand Up @@ -57,6 +59,7 @@ def set_health_check(self, health_check: HealthCheck):
"""Sets health check for DNSPolicy"""
self.model["spec"]["healthCheck"] = asdict(health_check)

@backoff.on_exception(backoff.fibo, OpenShiftPythonException, max_tries=13, jitter=None)
def get_dns_health_probe(self) -> oc.APIObject:
"""Returns DNSHealthCheckProbe object for the created DNSPolicy"""
with self.context:
Expand Down
2 changes: 0 additions & 2 deletions testsuite/tests/mgc/dnspolicy/health_check/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Conftest for DNSPolicy health checks"""
import time
import pytest

from testsuite.gateway import Hostname
Expand Down Expand Up @@ -51,5 +50,4 @@ def dns_policy(dns_policy, health_check):
@pytest.fixture(scope="module")
def dns_health_probe(dns_policy, route): # pylint: disable=unused-argument
"""Wait for health check to start monitoring endpoint and return according DNSHealthCheckProbe object"""
time.sleep(10)
return dns_policy.get_dns_health_probe()

0 comments on commit 70ebdd6

Please sign in to comment.