diff --git a/esrally/utils/net.py b/esrally/utils/net.py index 4c0a86839..db859470d 100644 --- a/esrally/utils/net.py +++ b/esrally/utils/net.py @@ -193,8 +193,13 @@ def download_http(url, local_path, expected_size_in_bytes=None, progress_indicat progress_indicator(bytes_read, size_from_content_header) return expected_size_in_bytes + def add_url_param_elastic_no_kpi(url): - return _add_url_param(url, {"x-elastic-no-kpi": "true"}) + scheme = urllib3.util.parse_url(url).scheme + if scheme.startswith("http"): + return _add_url_param(url, {"x-elastic-no-kpi": "true"}) + else: + return url def _add_url_param(url, params): diff --git a/tests/utils/net_test.py b/tests/utils/net_test.py index 862b20bc7..6ad5e1019 100644 --- a/tests/utils/net_test.py +++ b/tests/utils/net_test.py @@ -75,6 +75,11 @@ def test_add_url_param_elastic_no_kpi(self): assert net.add_url_param_elastic_no_kpi(url) == \ "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0.tar.gz?x-elastic-no-kpi=true" + def test_add_url_param_elastic_no_kpi_no_http(self): + url = "gs://my_bucket/builds/elasticsearch/elasticsearch-8.0.0-SNAPSHOT.tar.gz" + assert net.add_url_param_elastic_no_kpi(url) == \ + "gs://my_bucket/builds/elasticsearch/elasticsearch-8.0.0-SNAPSHOT.tar.gz" + def test_add_url_param_encoding_and_update(self): url = "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0.tar.gz?flag1=true" params = {"flag1": "test me", "flag2": "test@me"}