Skip to content

Commit

Permalink
Merge pull request #918 from dcs4cop/thomas_899_fix-ci
Browse files Browse the repository at this point in the history
fixing our current problems with GitHub CI
  • Loading branch information
thomasstorm authored Jan 18, 2024
2 parents 3bec012 + 7102fbb commit 1107099
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xcube/server/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
import json
import socket
import threading
import time
import unittest
from abc import ABC
from contextlib import closing
from typing import Dict, Optional, Any, Union, Tuple

import urllib3
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
from urllib3.exceptions import MaxRetryError

from xcube.server.server import Server
from xcube.server.webservers.tornado import TornadoFramework
Expand Down Expand Up @@ -65,6 +67,15 @@ def setUp(self) -> None:

self.http = urllib3.PoolManager()

# Taking care that server is fully started before tests make requests.
# Fixing https://github.com/dcs4cop/xcube/issues/899
while True:
try:
self.fetch('/')
break
except (MaxRetryError, TimeoutError):
time.sleep(0.1)

def tearDown(self) -> None:
self.server.stop()

Expand Down

0 comments on commit 1107099

Please sign in to comment.