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.
|
|
|
|
|
|
2023-11-10 13:20:26 -05:00
|
|
|
|
|
|
|
|
import warnings
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
from _pytest.mark.structures import MarkDecorator
|
2023-10-26 12:30:23 -04:00
|
|
|
|
|
|
|
|
from opensearchpy._async.client import AsyncOpenSearch
|
|
|
|
|
|
2023-11-10 13:20:26 -05:00
|
|
|
pytestmark: MarkDecorator = pytest.mark.asyncio
|
|
|
|
|
|
2023-10-26 12:30:23 -04:00
|
|
|
|
2023-11-10 13:20:26 -05:00
|
|
|
class TestPluginsClient:
|
2023-11-06 13:08:19 -05:00
|
|
|
async def test_plugins_client(self) -> None:
|
2023-11-10 13:20:26 -05:00
|
|
|
with warnings.catch_warnings(record=True) as w:
|
2023-10-26 12:30:23 -04:00
|
|
|
client = AsyncOpenSearch()
|
2023-11-09 10:51:20 -05:00
|
|
|
# testing double-init here
|
2024-01-22 09:12:57 -05:00
|
|
|
client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call
|
2023-11-10 13:20:26 -05:00
|
|
|
assert (
|
|
|
|
|
str(w[0].message)
|
2024-01-19 13:36:05 -05:00
|
|
|
== "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use "
|
|
|
|
|
"`AsyncOpenSearch.plugin.alerting` instead."
|
2023-10-26 12:30:23 -04:00
|
|
|
)
|