Skip to content

Commit 0380b65

Browse files
authored
Merge pull request #799 from theupdateframework/longer_testing_delays_for_appveyor
test: Delay more when spawning test servers to avoid rare failures
2 parents a372410 + 375ef4b commit 0380b65

2 files changed

Lines changed: 39 additions & 15 deletions

File tree

tests/test_proxy_use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def setUpClass(cls):
124124
# refused" errors. On the first test system. 0.1s was too short and 0.15s
125125
# was long enough. Use 0.5s to be safe, and if issues arise, increase it.
126126
# Observed some occasional AppVeyor failures, so increasing this to 1s.
127-
time.sleep(1)
127+
time.sleep(2)
128128

129129

130130

tests/test_updater.py

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,14 @@ def setUpClass(cls):
105105
logger.info('\tServing on port: '+str(cls.SERVER_PORT))
106106
cls.url = 'http://localhost:'+str(cls.SERVER_PORT) + os.path.sep
107107

108-
# NOTE: Following error is raised if a delay is not applied:
109-
# <urlopen error [Errno 111] Connection refused>
110-
time.sleep(1)
108+
# NOTE: Following error is raised if a delay is not long enough to allow
109+
# the server process to set up and start listening:
110+
# <urlopen error [Errno 111] Connection refused>
111+
# or, on Windows:
112+
# Failed to establish a new connection: [Errno 111] Connection refused'
113+
# While 0.3s has consistently worked on Travis and local builds, it led to
114+
# occasional failures in AppVeyor builds, so increasing this to 2s, sadly.
115+
time.sleep(2)
111116

112117

113118

@@ -1036,9 +1041,13 @@ def test_6_get_one_valid_targetinfo(self):
10361041
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
10371042
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
10381043

1039-
# NOTE: Following error is raised if a delay is not applied:
1044+
# NOTE: Following error is raised if a delay is not long enough:
10401045
# <urlopen error [Errno 111] Connection refused>
1041-
time.sleep(.3)
1046+
# or, on Windows:
1047+
# Failed to establish a new connection: [Errno 111] Connection refused'
1048+
# While 0.3s has consistently worked on Travis and local builds, it led to
1049+
# occasional failures in AppVeyor builds, so increasing this to 2s, sadly.
1050+
time.sleep(2)
10421051

10431052
# 'path/to/tmp/repository' -> 'localhost:8001/tmp/repository'.
10441053
repository_basepath = self.repository_directory[len(os.getcwd()):]
@@ -1289,9 +1298,14 @@ def test_7_updated_targets(self):
12891298
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
12901299
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
12911300

1292-
# NOTE: Following error is raised if a delay is not applied:
1293-
# <urlopen error [Errno 111] Connection refused>
1294-
time.sleep(.3)
1301+
# NOTE: Following error is raised if a delay is not long enough to allow
1302+
# the server process to set up and start listening:
1303+
# <urlopen error [Errno 111] Connection refused>
1304+
# or, on Windows:
1305+
# Failed to establish a new connection: [Errno 111] Connection refused'
1306+
# While 0.3s has consistently worked on Travis and local builds, it led to
1307+
# occasional failures in AppVeyor builds, so increasing this to 2s, sadly.
1308+
time.sleep(2)
12951309

12961310
# 'path/to/tmp/repository' -> 'localhost:8001/tmp/repository'.
12971311
repository_basepath = self.repository_directory[len(os.getcwd()):]
@@ -1416,9 +1430,14 @@ def test_8_remove_obsolete_targets(self):
14161430
command = ['python', '-m', 'tuf.scripts.simple_server', str(SERVER_PORT)]
14171431
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
14181432

1419-
# NOTE: Following error is raised if a delay is not applied:
1420-
# <urlopen error [Errno 111] Connection refused>
1421-
time.sleep(.3)
1433+
# NOTE: Following error is raised if a delay is not long enough to allow
1434+
# the server process to set up and start listening:
1435+
# <urlopen error [Errno 111] Connection refused>
1436+
# or, on Windows:
1437+
# Failed to establish a new connection: [Errno 111] Connection refused'
1438+
# While 0.3s has consistently worked on Travis and local builds, it led to
1439+
# occasional failures in AppVeyor builds, so increasing this to 2s, sadly.
1440+
time.sleep(2)
14221441

14231442
# 'path/to/tmp/repository' -> 'localhost:8001/tmp/repository'.
14241443
repository_basepath = self.repository_directory[len(os.getcwd()):]
@@ -1811,9 +1830,14 @@ def setUp(self):
18111830
self.url = 'http://localhost:' + str(self.SERVER_PORT) + os.path.sep
18121831
self.url2 = 'http://localhost:' + str(self.SERVER_PORT2) + os.path.sep
18131832

1814-
# NOTE: Following error is raised if a delay is not applied:
1815-
# <urlopen error [Errno 111] Connection refused>
1816-
time.sleep(.3)
1833+
# NOTE: Following error is raised if a delay is not long enough to allow
1834+
# the server process to set up and start listening:
1835+
# <urlopen error [Errno 111] Connection refused>
1836+
# or, on Windows:
1837+
# Failed to establish a new connection: [Errno 111] Connection refused'
1838+
# While 0.3s has consistently worked on Travis and local builds, it led to
1839+
# occasional failures in AppVeyor builds, so increasing this to 2s, sadly.
1840+
time.sleep(2)
18171841

18181842
url_prefix = 'http://localhost:' + str(self.SERVER_PORT)
18191843
url_prefix2 = 'http://localhost:' + str(self.SERVER_PORT2)

0 commit comments

Comments
 (0)