mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-03 23:51:48 +00:00
refactor: reuse exponential_backoff_function from hcloud-python (#535)
Replace the local function with the exponential_backoff_function from hcloud-python
This commit is contained in:
parent
b9a1509378
commit
c665629f7e
3 changed files with 7 additions and 40 deletions
|
|
@ -1,14 +1 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from ansible_collections.hetzner.hcloud.plugins.module_utils.client import (
|
||||
exponential_backoff_poll_interval,
|
||||
)
|
||||
|
||||
|
||||
def test_exponential_backoff_poll_interval():
|
||||
poll_interval = exponential_backoff_poll_interval(base=1.0, multiplier=2, cap=5.0, jitter=0.0)
|
||||
poll_max_retries = 25
|
||||
|
||||
results = [poll_interval(i) for i in range(poll_max_retries)]
|
||||
assert sum(results) == 117.0
|
||||
assert results[:6] == [1.0, 2.0, 4.0, 5.0, 5.0, 5.0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue