Change all instances of es->opensearch and ES->OPENSEARCH
Signed-off-by: Rushi Agrawal <[email protected]>
This commit is contained in:
@@ -33,13 +33,13 @@ from os import environ
|
||||
from os.path import abspath, dirname, exists, join, pardir
|
||||
|
||||
|
||||
def fetch_es_repo():
|
||||
def fetch_opensearch_repo():
|
||||
# user is manually setting YAML dir, don't tamper with it
|
||||
if "TEST_ES_YAML_DIR" in environ:
|
||||
if "TEST_OPENSEARCH_YAML_DIR" in environ:
|
||||
return
|
||||
|
||||
repo_path = environ.get(
|
||||
"TEST_ES_REPO",
|
||||
"TEST_OPENSEARCH_REPO",
|
||||
abspath(join(dirname(__file__), pardir, pardir, "opensearch")),
|
||||
)
|
||||
|
||||
@@ -51,12 +51,12 @@ def fetch_es_repo():
|
||||
)
|
||||
|
||||
# set YAML test dir
|
||||
environ["TEST_ES_YAML_DIR"] = join(
|
||||
environ["TEST_OPENSEARCH_YAML_DIR"] = join(
|
||||
repo_path, "rest-api-spec", "src", "main", "resources", "rest-api-spec", "test"
|
||||
)
|
||||
|
||||
# fetching of yaml tests disabled, we'll run with what's there
|
||||
if environ.get("TEST_ES_NOFETCH", False):
|
||||
if environ.get("TEST_OPENSEARCH_NOFETCH", False):
|
||||
return
|
||||
|
||||
from test_opensearch.test_cases import SkipTest
|
||||
@@ -87,7 +87,7 @@ def run_all(argv=None):
|
||||
|
||||
# fetch yaml tests anywhere that's not GitHub Actions
|
||||
if "GITHUB_ACTION" not in environ:
|
||||
fetch_es_repo()
|
||||
fetch_opensearch_repo()
|
||||
|
||||
# always insert coverage when running tests
|
||||
if argv is None:
|
||||
|
||||
@@ -47,7 +47,7 @@ from ...test_server.test_rest_api_spec import (
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
ES_VERSION = None
|
||||
OPENSEARCH_VERSION = None
|
||||
|
||||
|
||||
async def await_if_coro(x):
|
||||
@@ -80,15 +80,15 @@ class AsyncYamlRunner(YamlRunner):
|
||||
self.section("teardown")
|
||||
await self.run_code(self._teardown_code)
|
||||
|
||||
async def es_version(self):
|
||||
global ES_VERSION
|
||||
if ES_VERSION is None:
|
||||
async def opensearch_version(self):
|
||||
global OPENSEARCH_VERSION
|
||||
if OPENSEARCH_VERSION is None:
|
||||
version_string = (await self.client.info())["version"]["number"]
|
||||
if "." not in version_string:
|
||||
return ()
|
||||
version = version_string.strip().split(".")
|
||||
ES_VERSION = tuple(int(v) if v.isdigit() else 999 for v in version)
|
||||
return ES_VERSION
|
||||
OPENSEARCH_VERSION = tuple(int(v) if v.isdigit() else 999 for v in version)
|
||||
return OPENSEARCH_VERSION
|
||||
|
||||
def section(self, name):
|
||||
print(("=" * 10) + " " + name + " " + ("=" * 10))
|
||||
@@ -211,7 +211,7 @@ class AsyncYamlRunner(YamlRunner):
|
||||
min_version, max_version = version.split("-")
|
||||
min_version = _get_version(min_version) or (0,)
|
||||
max_version = _get_version(max_version) or (999,)
|
||||
if min_version <= (await self.es_version()) <= max_version:
|
||||
if min_version <= (await self.opensearch_version()) <= max_version:
|
||||
pytest.skip(reason)
|
||||
|
||||
async def _feature_enabled(self, name):
|
||||
|
||||
@@ -92,7 +92,7 @@ class TestStreamingBulk(OpenSearchTestCase):
|
||||
assert False, "exception should have been raised"
|
||||
|
||||
def test_different_op_types(self):
|
||||
if self.es_version() < (0, 90, 1):
|
||||
if self.opensearch_version() < (0, 90, 1):
|
||||
raise SkipTest("update supported since 0.90.1")
|
||||
self.client.index(index="i", id=45, body={})
|
||||
self.client.index(index="i", id=42, body={})
|
||||
|
||||
@@ -116,7 +116,7 @@ SKIP_TESTS = {
|
||||
}
|
||||
|
||||
|
||||
ES_VERSION = None
|
||||
OPENSEARCH_VERSION = None
|
||||
RUN_ASYNC_REST_API_TESTS = (
|
||||
sys.version_info >= (3, 6)
|
||||
and os.environ.get("PYTHON_CONNECTION_CLASS") == "RequestsHttpConnection"
|
||||
@@ -163,15 +163,15 @@ class YamlRunner:
|
||||
self.section("teardown")
|
||||
self.run_code(self._teardown_code)
|
||||
|
||||
def es_version(self):
|
||||
global ES_VERSION
|
||||
if ES_VERSION is None:
|
||||
def opensearch_version(self):
|
||||
global OPENSEARCH_VERSION
|
||||
if OPENSEARCH_VERSION is None:
|
||||
version_string = (self.client.info())["version"]["number"]
|
||||
if "." not in version_string:
|
||||
return ()
|
||||
version = version_string.strip().split(".")
|
||||
ES_VERSION = tuple(int(v) if v.isdigit() else 999 for v in version)
|
||||
return ES_VERSION
|
||||
OPENSEARCH_VERSION = tuple(int(v) if v.isdigit() else 999 for v in version)
|
||||
return OPENSEARCH_VERSION
|
||||
|
||||
def section(self, name):
|
||||
print(("=" * 10) + " " + name + " " + ("=" * 10))
|
||||
@@ -311,7 +311,7 @@ class YamlRunner:
|
||||
min_version, max_version = version.split("-")
|
||||
min_version = _get_version(min_version) or (0,)
|
||||
max_version = _get_version(max_version) or (999,)
|
||||
if min_version <= (self.es_version()) <= max_version:
|
||||
if min_version <= (self.opensearch_version()) <= max_version:
|
||||
pytest.skip(reason)
|
||||
|
||||
def run_gt(self, action):
|
||||
|
||||
Reference in New Issue
Block a user