Commit 24c124a5 authored by David Mendez's avatar David Mendez
Browse files

Context Loader: always use http to load context

parent f2317f73
......@@ -169,7 +169,7 @@ functional_tests:
url: ${SERVER_URL_STAGING}
script:
- set -x
- functional_tests/run_functional_tests.py ${SERVER_URL_STAGING}
- functional_tests/run_functional_tests.py ${SERVER_URL_STAGING} https://wwwdev.ebi.ac.uk/chembl/interface_api/delayed_jobs
## ----------------------------------------------------------------------------------------------------------------------
## Deployment to prod hx
......@@ -233,7 +233,7 @@ functional_tests_prod_hx:
script:
- set -x
- sleep 30 # Give some time for the deployment to take effect.
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HX}
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HX} https://wwwdev.ebi.ac.uk/chembl/interface_api/delayed_jobs
## ----------------------------------------------------------------------------------------------------------------------
## Deployment to prod hh
......@@ -300,7 +300,7 @@ functional_tests_prod_hh:
script:
- set -x
- sleep 30 # Give some time for the deployment to take effect.
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HH}
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_HH} https://www.ebi.ac.uk/chembl/interface_api/delayed_jobs
# ----------------------------------------------------------------------------------------------------------------------
# Test prod public url
......@@ -315,4 +315,4 @@ functional_tests_prod_public:
script:
- set -x
- sleep 30 # Give some time for the deployment to take effect.
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_PUBLIC}
- functional_tests/run_functional_tests.py ${SERVER_URL_PROD_PUBLIC} https://www.ebi.ac.uk/chembl/interface_api/delayed_jobs
......@@ -27,6 +27,13 @@ def get_context_url(context_dict):
mapped_host = host_mappings.get(host)
mapped_base_url = context_dict['delayed_jobs_base_url'].replace(host, mapped_host)
# Make sure to always use http because connection is internal
scheme = re.search(r'^http(s)?://', mapped_base_url).group(0)
if scheme is None:
mapped_base_url = f'http://{mapped_base_url}'
else:
mapped_base_url = mapped_base_url.replace(scheme, 'http://')
return f'{mapped_base_url}/outputs/{context_dict["context_id"]}/results.json'
......
......@@ -27,8 +27,9 @@ class TestContextLoader(unittest.TestCase):
host_mappings = RUN_CONFIG.get('delayed_jobs', {}).get('server_mapping', {})
mapped_host = host_mappings.get(host)
mapped_base_url = context_dict['delayed_jobs_base_url'].replace(host, mapped_host)
base_url_with_correct_schema = mapped_base_url.replace('https://', 'http://')
context_url_must_be = f'{mapped_base_url}/outputs/{context_dict["context_id"]}/results.json'
context_url_must_be = f'{base_url_with_correct_schema}/outputs/{context_dict["context_id"]}/results.json'
context_url_got = context_loader.get_context_url(context_dict)
self.assertEqual(context_url_must_be, context_url_got, msg='The context url was not generated correctly!')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment