Skip to content

Commit 442fb00

Browse files
fixes server start test by fixing mock and adding delay in retry attempts
1 parent c422573 commit 442fb00

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

wiremock/server/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def start(self):
6262
if resp.status_code == 200:
6363
success = True
6464
break
65+
time.sleep(0.25)
6566

6667
if not success:
6768
raise WireMockServerNotStartedError("unable to get a successful GET http://localhost:{}/__admin response".format(self.port))

wiremock/tests/server_tests/server_tests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import unittest
55
from subprocess import STDOUT, PIPE
66

7+
import responses
78
from mock import patch, DEFAULT
89
from pkg_resources import resource_filename
910

@@ -56,7 +57,11 @@ def test_get_free_port(self, mock_socket):
5657
@attr("unit", "server")
5758
@patch("wiremock.server.server.atexit")
5859
@patch("wiremock.server.server.Popen")
60+
@responses.activate
5961
def test_start(self, Popen, atexit):
62+
# mock healthy endpoint
63+
responses.add(responses.GET, "http://localhost/__admin", json=[], status=200)
64+
6065
def poll():
6166
Popen.return_value.returncode = None
6267
return None

0 commit comments

Comments
 (0)