Add retry logic, listenOnUnused is potentially flaky.

This commit is contained in:
Itamar Turner-Trauring 2020-07-28 11:08:38 -04:00
parent 4fdcd06fbd
commit 4dae5d867c
2 changed files with 5 additions and 0 deletions

View File

@ -390,6 +390,7 @@ setup(name="tahoe-lafs", # also set in __init__.py
"beautifulsoup4",
"html5lib",
"junitxml",
"tenacity",
] + tor_requires + i2p_requires,
"tor": tor_requires,
"i2p": i2p_requires,

View File

@ -17,6 +17,8 @@ import re, errno, subprocess, os, socket
from twisted.trial import unittest
from tenacity import retry, stop_after_attempt
from foolscap.api import Tub
from allmydata.util import iputil
@ -199,6 +201,7 @@ class ListenOnUsed(unittest.TestCase):
self.addCleanup(tub.stopService)
return tub
@retry(stop=stop_after_attempt(7))
def test_random_port(self):
"""A random port is selected if none is given."""
tub = self.create_tub("utils/ListenOnUsed/test_randomport")
@ -215,6 +218,7 @@ class ListenOnUsed(unittest.TestCase):
portnum2 = iputil.listenOnUnused(tub2)
self.assertNotEqual(portnum, portnum2)
@retry(stop=stop_after_attempt(7))
def test_specific_port(self):
"""The given port is used."""
tub = self.create_tub("utils/ListenOnUsed/test_givenport")