2023-10-26 12:30:23 -04:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
#
|
|
|
|
|
# The OpenSearch Contributors require contributions made to
|
|
|
|
|
# this file be licensed under the Apache-2.0 license or a
|
|
|
|
|
# compatible open source license.
|
|
|
|
|
#
|
|
|
|
|
# Modifications Copyright OpenSearch Contributors. See
|
|
|
|
|
# GitHub history for details.
|
|
|
|
|
|
2024-09-27 20:14:17 +02:00
|
|
|
import re
|
|
|
|
|
|
2023-10-26 12:30:23 -04:00
|
|
|
from opensearchpy.client import OpenSearch
|
|
|
|
|
|
|
|
|
|
from ...test_cases import TestCase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestPluginsClient(TestCase):
|
2023-11-06 13:08:19 -05:00
|
|
|
def test_plugins_client(self) -> None:
|
2023-10-26 12:30:23 -04:00
|
|
|
with self.assertWarns(Warning) as w:
|
|
|
|
|
client = OpenSearch()
|
2023-11-09 10:51:20 -05:00
|
|
|
# double-init
|
2024-01-22 09:12:57 -05:00
|
|
|
client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call
|
2024-09-27 20:14:17 +02:00
|
|
|
self.assertTrue(
|
|
|
|
|
re.match(
|
|
|
|
|
r"Cannot load `\w+` directly to OpenSearch as it already exists. Use `OpenSearch.plugin.\w+` instead.",
|
|
|
|
|
str(w.warnings[0].message),
|
|
|
|
|
)
|
2023-10-26 12:30:23 -04:00
|
|
|
)
|