@@ -104,6 +104,18 @@ def merge_mongod_args(self, add_args):
104
104
self .port , add_args [:] = cli .extract_param ('port' , add_args , type = int )
105
105
self .mongod_args = add_args
106
106
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
+
107
119
def start (self ):
108
120
super (MongoDBInstance , self ).start ()
109
121
if not hasattr (self , 'port' ) or not self .port :
@@ -119,7 +131,7 @@ def start(self):
119
131
if hasattr (self , 'bind_ip' ) and '--bind_ip' not in cmd :
120
132
cmd .extend (['--bind_ip' , self .bind_ip ])
121
133
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 )
123
135
log .info (f'{ self } listening on { self .port } ' )
124
136
125
137
def get_connection (self ):
0 commit comments