From 3eac282c57552ef196e16c35132cca1d06f122b2 Mon Sep 17 00:00:00 2001 From: Rushi Agrawal Date: Mon, 16 Aug 2021 17:20:29 +0530 Subject: [PATCH] Rename 7.10.2 -> 1.0.0 everywhere Renaming caused breakages in API versioning code, so removed that part because we will anyways be removing the whole Elastic API versioning logic in near future. Also removed unused variable in .github/workflows/integration.yml Signed-off-by: Rushi Agrawal --- .github/workflows/integration.yml | 3 +-- .github/workflows/unified-release.yml | 2 +- opensearch/_version.py | 2 +- opensearch/connection/base.py | 10 +--------- opensearch/serializer.py | 8 ++------ test_opensearch/test_connection.py | 21 --------------------- test_opensearch/test_serializer.py | 11 ----------- 7 files changed, 6 insertions(+), 51 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f5e8f619..6041c36f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -19,11 +19,10 @@ jobs: strategy: fail-fast: false matrix: - stack_version: ['7.10.2'] cluster: ["opendistro", "opensearch"] steps: - name: Checkout uses: actions/checkout@v2 - run: "./.ci/run-tests ${{ matrix.cluster }} " - name: Integ ${{ matrix.stack_version }} ${{ matrix.cluster }} + name: Integ ${{ matrix.cluster }} diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml index dd3c2aaf..67c86dc3 100644 --- a/.github/workflows/unified-release.yml +++ b/.github/workflows/unified-release.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - stack_version: ['7.10.2'] + stack_version: ['1.0.0'] steps: - name: Checkout diff --git a/opensearch/_version.py b/opensearch/_version.py index 39a87dc8..7fd3764d 100644 --- a/opensearch/_version.py +++ b/opensearch/_version.py @@ -24,4 +24,4 @@ # specific language governing permissions and limitations # under the License. -__versionstr__ = "7.10.2" +__versionstr__ = "1.0.0" diff --git a/opensearch/connection/base.py b/opensearch/connection/base.py index 2a70e2d5..05d81c71 100644 --- a/opensearch/connection/base.py +++ b/opensearch/connection/base.py @@ -28,7 +28,6 @@ import binascii import gzip import io import logging -import os import re import warnings from platform import python_version @@ -38,7 +37,7 @@ try: except ImportError: import json -from .. import __version__, __versionstr__ +from .. import __versionstr__ from ..exceptions import ( HTTP_EXCEPTIONS, ImproperlyConfigured, @@ -128,13 +127,6 @@ class Connection(object): if opaque_id: self.headers["x-opaque-id"] = opaque_id - if os.getenv("ELASTIC_CLIENT_APIVERSIONING") == "1": - self.headers.setdefault( - "accept", - "application/vnd.opensearch+json;compatible-with=%s" - % (str(__version__[0]),), - ) - self.headers.setdefault("content-type", "application/json") self.headers.setdefault("user-agent", self._get_default_user_agent()) diff --git a/opensearch/serializer.py b/opensearch/serializer.py index 2f42798d..fcc9b146 100644 --- a/opensearch/serializer.py +++ b/opensearch/serializer.py @@ -163,12 +163,8 @@ class Deserializer(object): if not mimetype: deserializer = self.default else: - # split out 'charset' and 'compatible-width' options - mimetype = mimetype.partition(";")[0].strip() - # Treat 'application/vnd.opensearch+json' - # as application/json for compatibility. - if mimetype == "application/vnd.opensearch+json": - mimetype = "application/json" + # split out charset + mimetype, _, _ = mimetype.partition(";") try: deserializer = self.serializers[mimetype] except KeyError: diff --git a/test_opensearch/test_connection.py b/test_opensearch/test_connection.py index 9659f124..c02a7183 100644 --- a/test_opensearch/test_connection.py +++ b/test_opensearch/test_connection.py @@ -28,7 +28,6 @@ import gzip import io import json -import os import re import ssl import warnings @@ -174,26 +173,6 @@ class TestBaseConnection(TestCase): conn = Connection(**kwargs) assert conn.host == expected_host - def test_compatibility_accept_header(self): - try: - conn = Connection() - assert "accept" not in conn.headers - - os.environ["ELASTIC_CLIENT_APIVERSIONING"] = "0" - - conn = Connection() - assert "accept" not in conn.headers - - os.environ["ELASTIC_CLIENT_APIVERSIONING"] = "1" - - conn = Connection() - assert ( - conn.headers["accept"] - == "application/vnd.opensearch+json;compatible-with=7" - ) - finally: - os.environ.pop("ELASTIC_CLIENT_APIVERSIONING") - class TestUrllib3Connection(TestCase): def _get_mock_connection(self, connection_params={}, response_body=b"{}"): diff --git a/test_opensearch/test_serializer.py b/test_opensearch/test_serializer.py index b92ab3f3..aa7d2c25 100644 --- a/test_opensearch/test_serializer.py +++ b/test_opensearch/test_serializer.py @@ -226,17 +226,6 @@ class TestDeserializer(TestCase): self.de.loads('{"some":"data"}', "text/plain; charset=whatever"), ) - def test_deserialize_compatibility_header(self): - for content_type in ( - "application/vnd.opensearch+json;compatible-with=7", - "application/vnd.opensearch+json; compatible-with=7", - "application/vnd.opensearch+json;compatible-with=8", - "application/vnd.opensearch+json; compatible-with=8", - ): - self.assertEqual( - {"some": "data"}, self.de.loads('{"some":"data"}', content_type) - ) - def test_raises_serialization_error_on_unknown_mimetype(self): self.assertRaises(SerializationError, self.de.loads, "{}", "text/html")