Skip to content

Commit cd1cf2d

Browse files
committed
Extend timeout more
1 parent 5733963 commit cd1cf2d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ env:
2626
PY_COLORS
2727
PYTEST_THEME
2828
PYTEST_THEME_MODE
29+
GITHUB_*
30+
RUNNER_*
2931
3032
# Suppress noisy pip warnings
3133
PIP_DISABLE_PIP_VERSION_CHECK: 'true'

jaraco/mongodb/service.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ def merge_mongod_args(self, add_args):
104104
self.port, add_args[:] = cli.extract_param('port', add_args, type=int)
105105
self.mongod_args = add_args
106106

107+
@property
108+
def _startup_timeout(self):
109+
"""
110+
On GitHub Actions on Windows, MongoDB takes forever to
111+
start, but starts up fast locally and on other platforms.
112+
"""
113+
slow = (
114+
os.environ.get('GITHUB_ACTIONS')
115+
and os.environ.get('RUNNER_OS') == 'Windows'
116+
)
117+
return 120 if slow else 10
118+
107119
def start(self):
108120
super(MongoDBInstance, self).start()
109121
if not hasattr(self, 'port') or not self.port:
@@ -119,7 +131,7 @@ def start(self):
119131
if hasattr(self, 'bind_ip') and '--bind_ip' not in cmd:
120132
cmd.extend(['--bind_ip', self.bind_ip])
121133
self.process = subprocess.Popen(cmd, **self.process_kwargs)
122-
portend.occupied('localhost', self.port, timeout=10)
134+
portend.occupied('localhost', self.port, timeout=self._startup_timeout)
123135
log.info(f'{self} listening on {self.port}')
124136

125137
def get_connection(self):

0 commit comments

Comments
 (0)