mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 11:28:09 +00:00
Working in retry to test endpoint during integration test. (#1565)
This commit is contained in:
committed by
GitHub
parent
af684f1335
commit
d358938895
@ -223,6 +223,7 @@ TARGETS: Dict[str, Integration] = {
|
|||||||
|
|
||||||
OperationResult = TypeVar("OperationResult")
|
OperationResult = TypeVar("OperationResult")
|
||||||
|
|
||||||
|
|
||||||
def retry(
|
def retry(
|
||||||
operation: Callable[[Any], OperationResult],
|
operation: Callable[[Any], OperationResult],
|
||||||
description: str,
|
description: str,
|
||||||
@ -251,6 +252,7 @@ def retry(
|
|||||||
)
|
)
|
||||||
time.sleep(wait_duration)
|
time.sleep(wait_duration)
|
||||||
|
|
||||||
|
|
||||||
class TestOnefuzz:
|
class TestOnefuzz:
|
||||||
def __init__(self, onefuzz: Onefuzz, logger: logging.Logger, test_id: UUID) -> None:
|
def __init__(self, onefuzz: Onefuzz, logger: logging.Logger, test_id: UUID) -> None:
|
||||||
self.of = onefuzz
|
self.of = onefuzz
|
||||||
@ -268,6 +270,11 @@ class TestOnefuzz:
|
|||||||
pool_size: int,
|
pool_size: int,
|
||||||
os_list: List[OS],
|
os_list: List[OS],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
def try_info_get(data: Any) -> None:
|
||||||
|
self.of.info.get()
|
||||||
|
|
||||||
|
retry(try_info_get, "testing endpoint")
|
||||||
|
|
||||||
self.inject_log(self.start_log_marker)
|
self.inject_log(self.start_log_marker)
|
||||||
for entry in os_list:
|
for entry in os_list:
|
||||||
name = PoolName(f"testpool-{entry.name}-{self.test_id}")
|
name = PoolName(f"testpool-{entry.name}-{self.test_id}")
|
||||||
@ -915,7 +922,7 @@ class Run(Command):
|
|||||||
if test_id is None:
|
if test_id is None:
|
||||||
test_id = uuid4()
|
test_id = uuid4()
|
||||||
self.logger.info("launching test_id: %s", test_id)
|
self.logger.info("launching test_id: %s", test_id)
|
||||||
|
|
||||||
def try_setup(data: Any) -> None:
|
def try_setup(data: Any) -> None:
|
||||||
self.onefuzz.__setup__(
|
self.onefuzz.__setup__(
|
||||||
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
endpoint=endpoint, client_id=client_id, client_secret=client_secret
|
||||||
|
Reference in New Issue
Block a user