Skip to content

Commit

Permalink
Retry a few times before failing
Browse files Browse the repository at this point in the history
ES might not be ready in GitHub Actions before test setup is run. Retry a few times before failing the test.
  • Loading branch information
zcqian committed Aug 20, 2021
1 parent 997daeb commit 4560a24
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions biothings/tests/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@

import pytest
import requests
import urllib3
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry

from biothings.utils.common import traverse
from biothings.web.launcher import BiothingsAPI
from biothings.web.settings import configs
Expand Down Expand Up @@ -242,6 +246,10 @@ def _setup_elasticsearch(self):
return

s = requests.Session()
s.mount('http://',
adapter=requests.adapters.HTTPAdapter(
max_retries=urllib3.Retry(total=5, backoff_factor=3.0)
)) # values seem reasonable
es_host = 'http://' + self.config.ES_HOST

server_info = s.get(es_host).json()
Expand Down

0 comments on commit 4560a24

Please sign in to comment.