apitests: try harder to wait for startup

Observe server state and wait longer if in one of the startup states.
This commit is contained in:
Dan Bungert 2021-11-16 18:06:08 -07:00
parent 7920c2e18b
commit ee48b0990a
1 changed files with 7 additions and 1 deletions

View File

@ -82,7 +82,13 @@ class Client:
async def poll_startup(self):
for _ in range(default_timeout * 10):
try:
await self.get('/meta/status')
resp = await self.get('/meta/status')
if resp["state"] in ('STARTING_UP', 'CLOUD_INIT_WAIT',
'EARLY_COMMANDS'):
await asyncio.sleep(.5)
continue
if resp["state"] == 'ERROR':
raise Exception('server in error state')
return
except aiohttp.client_exceptions.ClientConnectorError:
await asyncio.sleep(.5)