From 5d11f7c13c30d3f167b24279638440351915d503 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 15 Apr 2024 17:13:55 +0200 Subject: [PATCH] elasticsearch: stop testing on ancient versions Pick 6.0 as the baseline. --- docs-requirements.txt | 2 +- .../pyproject.toml | 2 +- .../test-requirements-0.txt | 22 ------------- .../test-requirements-1.txt | 22 ------------- ...irements-2.txt => test-requirements-6.txt} | 0 .../tests/helpers_es2.py | 33 ------------------- .../tests/helpers_es5.py | 33 ------------------- .../tests/test_elasticsearch.py | 4 --- tox.ini | 10 ++---- 9 files changed, 5 insertions(+), 123 deletions(-) delete mode 100644 instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt delete mode 100644 instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt rename instrumentation/opentelemetry-instrumentation-elasticsearch/{test-requirements-2.txt => test-requirements-6.txt} (100%) delete mode 100644 instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es2.py delete mode 100644 instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es5.py diff --git a/docs-requirements.txt b/docs-requirements.txt index aff449fcf8..72f4472902 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -28,7 +28,7 @@ boto3~=1.0 cassandra-driver~=3.25 celery>=4.0 confluent-kafka>= 1.8.2,<= 2.3.0 -elasticsearch>=2.0,<9.0 +elasticsearch>=6.0,<9.0 flask~=2.0 falcon~=2.0 grpcio~=1.27 diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml b/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml index 659366181a..f5ba221b7f 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ [project.optional-dependencies] instruments = [ - "elasticsearch >= 2.0", + "elasticsearch >= 6.0", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt deleted file mode 100644 index 216d1c0b02..0000000000 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-0.txt +++ /dev/null @@ -1,22 +0,0 @@ -asgiref==3.7.2 -attrs==23.2.0 -Deprecated==1.2.14 -elasticsearch==2.4.1 -elasticsearch-dsl==2.2.0 -importlib-metadata==6.11.0 -iniconfig==2.0.0 -packaging==23.2 -pluggy==1.4.0 -py==1.11.0 -py-cpuinfo==9.0.0 -pytest==7.1.3 -pytest-benchmark==4.0.0 -python-dateutil==2.8.2 -six==1.16.0 -tomli==2.0.1 -typing_extensions==4.10.0 -urllib3==1.26.18 -wrapt==1.16.0 -zipp==3.17.0 --e opentelemetry-instrumentation --e instrumentation/opentelemetry-instrumentation-elasticsearch diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt deleted file mode 100644 index 2c51c87508..0000000000 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-1.txt +++ /dev/null @@ -1,22 +0,0 @@ -asgiref==3.7.2 -attrs==23.2.0 -Deprecated==1.2.14 -elasticsearch==5.5.3 -elasticsearch-dsl==5.4.0 -importlib-metadata==6.11.0 -iniconfig==2.0.0 -packaging==23.2 -pluggy==1.4.0 -py==1.11.0 -py-cpuinfo==9.0.0 -pytest==7.1.3 -pytest-benchmark==4.0.0 -python-dateutil==2.8.2 -six==1.16.0 -tomli==2.0.1 -typing_extensions==4.10.0 -urllib3==2.2.1 -wrapt==1.16.0 -zipp==3.17.0 --e opentelemetry-instrumentation --e instrumentation/opentelemetry-instrumentation-elasticsearch diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-6.txt similarity index 100% rename from instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-2.txt rename to instrumentation/opentelemetry-instrumentation-elasticsearch/test-requirements-6.txt diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es2.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es2.py deleted file mode 100644 index 008a95d671..0000000000 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es2.py +++ /dev/null @@ -1,33 +0,0 @@ -from elasticsearch_dsl import ( # pylint: disable=no-name-in-module - DocType, - String, -) - - -class Article(DocType): - title = String(analyzer="snowball", fields={"raw": String()}) - body = String(analyzer="snowball") - - class Meta: - index = "test-index" - - -dsl_create_statement = { - "mappings": { - "article": { - "properties": { - "title": { - "analyzer": "snowball", - "fields": {"raw": {"type": "string"}}, - "type": "string", - }, - "body": {"analyzer": "snowball", "type": "string"}, - } - } - }, - "settings": {"analysis": {}}, -} -dsl_index_result = (1, {}, '{"created": true}') -dsl_index_span_name = "Elasticsearch/test-index/article/2" -dsl_index_url = "/test-index/article/2" -dsl_search_method = "GET" diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es5.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es5.py deleted file mode 100644 index cf32d98863..0000000000 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/helpers_es5.py +++ /dev/null @@ -1,33 +0,0 @@ -from elasticsearch_dsl import ( # pylint: disable=no-name-in-module - DocType, - Keyword, - Text, -) - - -class Article(DocType): - title = Text(analyzer="snowball", fields={"raw": Keyword()}) - body = Text(analyzer="snowball") - - class Meta: - index = "test-index" - - -dsl_create_statement = { - "mappings": { - "article": { - "properties": { - "title": { - "analyzer": "snowball", - "fields": {"raw": {"type": "keyword"}}, - "type": "text", - }, - "body": {"analyzer": "snowball", "type": "text"}, - } - } - }, -} -dsl_index_result = (1, {}, '{"created": true}') -dsl_index_span_name = "Elasticsearch/test-index/article/2" -dsl_index_url = "/test-index/article/2" -dsl_search_method = "GET" diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py index 6008108d79..5d1c85f77d 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py @@ -44,10 +44,6 @@ from . import helpers_es7 as helpers # pylint: disable=no-name-in-module elif major_version == 6: from . import helpers_es6 as helpers # pylint: disable=no-name-in-module -elif major_version == 5: - from . import helpers_es5 as helpers # pylint: disable=no-name-in-module -else: - from . import helpers_es2 as helpers # pylint: disable=no-name-in-module Article = helpers.Article diff --git a/tox.ini b/tox.ini index 420ae899f0..e598c30f40 100644 --- a/tox.ini +++ b/tox.ini @@ -78,13 +78,9 @@ envlist = ; FIXME: Elasticsearch >=7 causes CI workflow tests to hang, see open-telemetry/opentelemetry-python-contrib#620 ; The numbers at the end of the environment names ; below mean these dependencies are being used: - ; 0: elasticsearch-dsl>=2.0,<3.0 elasticsearch>=2.0,<3.0 - ; 1: elasticsearch-dsl>=5.0,<6.0 elasticsearch>=5.0,<6.0 - ; 2: elasticsearch-dsl>=6.0,<7.0 elasticsearch>=6.0,<7.0 - py3{8,9,10,11}-test-instrumentation-elasticsearch-{0,2} - pypy3-test-instrumentation-elasticsearch-{0,2} - py3{8,9}-test-instrumentation-elasticsearch-1 - pypy3-test-instrumentation-elasticsearch-1 + ; 6: elasticsearch-dsl>=6.0,<7.0 elasticsearch>=6.0,<7.0 + py3{8,9,10,11}-test-instrumentation-elasticsearch-{6} + pypy3-test-instrumentation-elasticsearch-{6} ; opentelemetry-instrumentation-falcon ; py310 does not work with falcon 1