Skip to content

Commit

Permalink
FIX: test environment cannot connect to ES
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed Jul 10, 2024
1 parent 91b0315 commit f135a52
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
from time_execution import settings
from time_execution.backends.elasticsearch import ElasticsearchBackend

# This variable is set by tox-docker. See https://tox-docker.readthedocs.io/en/latest/#configuration
ELASTICSEARCH_HOST = os.getenv("ELASTICSEARCH_HOST", "localhost")
ELASTICSEARCH_URI = f"http://{ELASTICSEARCH_HOST}:9200"
# These variables are set by tox-docker. See https://tox-docker.readthedocs.io/en/latest/#configuration
ELASTICSEARCH_HOST = os.getenv("ELASTICSEARCH_HOST")
if not ELASTICSEARCH_HOST:
raise RuntimeError("`ELASTICSEARCH_HOST` is not set")

ELASTICSEARCH_PORT = os.getenv("ELASTICSEARCH_9200_TCP_PORT")
if not ELASTICSEARCH_PORT:
raise RuntimeError("`ELASTICSEARCH_9200_TCP_PORT` is not set")

ELASTICSEARCH_URI = f"http://{ELASTICSEARCH_HOST}:{ELASTICSEARCH_PORT}"


class TestConnectionErrors(TestBaseBackend):
Expand Down

0 comments on commit f135a52

Please sign in to comment.