Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#384 Fixes async basic auth (http_async.py) #385

Closed
wants to merge 2 commits into from

Conversation

GRomR1
Copy link

@GRomR1 GRomR1 commented May 8, 2023

Description

Fix async basic auth

Issues Resolved

Closes #384

Signed-off-by: Ruslan Gainanov <gromrx1@gmail.com>
@dblock
Copy link
Member

dblock commented May 9, 2023

Thanks! Needs a test and a CHANGELOG entry, please?

@GRomR1
Copy link
Author

GRomR1 commented May 10, 2023

@dblock ok, thanks for review. I'll add this to changelog. But I don't know how designed tests and CI in the project. It's very hard to me fix them.

Also I found these tests -

def test_http_auth_tuple(self):
con = AIOHttpConnection(http_auth=("username", "secret"))
assert {
"authorization": "Basic dXNlcm5hbWU6c2VjcmV0",
"content-type": "application/json",
"connection": "keep-alive",
"user-agent": con._get_default_user_agent(),
} == con.headers

It seems like project already have tests for http_auth.

Signed-off-by: Ruslan Gainanov <gromrx1@gmail.com>
@dblock
Copy link
Member

dblock commented May 10, 2023

@dblock ok, thanks for review. I'll add this to changelog. But I don't know how designed tests and CI in the project. It's very hard to me fix them.

Also I found these tests -

def test_http_auth_tuple(self):
con = AIOHttpConnection(http_auth=("username", "secret"))
assert {
"authorization": "Basic dXNlcm5hbWU6c2VjcmV0",
"content-type": "application/json",
"connection": "keep-alive",
"user-agent": con._get_default_user_agent(),
} == con.headers

It seems like project already have tests for http_auth.

You would need to dig into this and write a test that would fail without this change. Reading the description of your fix it seems that async basic auth doesn't work. So write a test that shows in what way it doesn't work, make sure it fails without the fix. Then add the fix and make sure the test passes. Without a test, there's no guarantee we won't accidentally re-introduce a regression and break your fix.

The test you linked is testing AIOHttpConnection, whereas the bug is in AsyncHttpConnection. Add tests for AsyncHttpConnection into (a new) test_http_async.py that exercise various scenarios of AsyncHttpConnection. They would probably look similar to those in AIOHttpConnection which the AsyncHttpConnection is a subclass of.

@GRomR1
Copy link
Author

GRomR1 commented May 12, 2023

I don't know how to run tests. I was trying clone a repo and run them with ./.ci/run-tests, but it doesn't help me. Sorry, I have not a big knowledge in python.

By the way I write a script that approve the error.

docker run -ti python:3 bash

pip install opensearch-py[async]

cat << EOT >> test.py
import asyncio
from opensearchpy import AsyncOpenSearch, AsyncHttpConnection

async def main():
  client = AsyncOpenSearch(
      hosts = [{'host': 'localhost', 'port': 9200}],
      http_auth = ("admin", "admin"),
      use_ssl = True,
      verify_certs = False,
      ssl_show_warn=False,
      connection_class = AsyncHttpConnection
  )
  print(f"{id(client)} {await client.info()}")
  await client.close()

asyncio.run(main())
EOT

python3 test.py

Running test.py will show the error:

root@4671d17cd1b4:/# python3 test.py
Traceback (most recent call last):
  File "//test.py", line 16, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "//test.py", line 13, in main
    print(f"{id(client)} {await client.info()}")
                          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/opensearchpy/_async/client/__init__.py", line 249, in info
    return await self.transport.perform_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/opensearchpy/_async/transport.py", line 374, in perform_request
    status, headers_response, data = await connection.perform_request(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/opensearchpy/connection/http_async.py", line 195, in perform_request
    **self._http_auth(method, url, query_string, body),
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'str' object is not callable
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fcc45c2ba10>

@saimedhi
Copy link
Collaborator

saimedhi commented May 13, 2023

Hello @GRomR1, please go through the developer guide to know more about testing.
For lint format: nox -rs format
For CI or unit tests: nox -rs test
For integration tests: ./.ci/run-tests true 2.4.1 or ./.ci/run-tests false 2.4.1 (Here, 2.4.1 is opensearch server version, please change it as required)

@GRomR1
Copy link
Author

GRomR1 commented May 13, 2023

@saimedhi thank for your advice. I've already pass through this guide. If I run the command nox -rs test all tests passed and I see next result:

...
=================================================================== 727 passed, 2 skipped, 25 warnings in 42.21s ===================================================================
nox > Session test-3.9 was successful.
nox > Ran multiple sessions:
nox > * test-2.7: skipped
nox > * test-3.4: skipped
nox > * test-3.5: skipped
nox > * test-3.6: skipped
nox > * test-3.7: skipped
nox > * test-3.8: skipped
nox > * test-3.9: success

But it doesn't help me to understand next things:

  • is it ok, so many tracebacks ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129) or not?
  • why I did't see failed test_http_auth, test_http_auth_tuple, test_http_auth_list? All them passed.
  • how to describe all these warnings (is it ok or not?):
================================================================================= warnings summary =================================================================================
test_opensearchpy/test_connection.py::TestUrllib3Connection::test_uses_no_ca_certs
  /Users/user/Documents/code/my/opensearch-py/opensearchpy/connection/http_urllib3.py:199: UserWarning: Connecting to https://localhost:9200 using SSL with verify_certs=False is insecure.
    warnings.warn(

test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
  /Users/user/Documents/code/my/opensearch-py/test_opensearchpy/test_serializer.py:113: DeprecationWarning: Please use assertRegex instead.
    self.assertRegexpMatches(

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_as_http_auth
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_as_http_auth' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_credentials_is_null
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_credentials_is_null' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_region_is_null
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_region_is_null' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_service_is_specified
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_service_is_specified' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_opaque_id
  test_opensearchpy/test_async/test_connection.py:96: PytestWarning: The test <Function test_opaque_id> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_opaque_id(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_default_user_agent
  test_opensearchpy/test_async/test_connection.py:150: PytestWarning: The test <Function test_default_user_agent> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_default_user_agent(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_timeout_set
  test_opensearchpy/test_async/test_connection.py:157: PytestWarning: The test <Function test_timeout_set> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_timeout_set(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_keep_alive_is_on_by_default
  test_opensearchpy/test_async/test_connection.py:161: PytestWarning: The test <Function test_keep_alive_is_on_by_default> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_keep_alive_is_on_by_default(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth
  test_opensearchpy/test_async/test_connection.py:169: PytestWarning: The test <Function test_http_auth> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth_tuple
  test_opensearchpy/test_async/test_connection.py:178: PytestWarning: The test <Function test_http_auth_tuple> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth_tuple(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth_list
  test_opensearchpy/test_async/test_connection.py:187: PytestWarning: The test <Function test_http_auth_list> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth_list(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_https_if_verify_certs_is_off
  test_opensearchpy/test_async/test_connection.py:196: PytestWarning: The test <Function test_uses_https_if_verify_certs_is_off> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_uses_https_if_verify_certs_is_off(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_doesnt_use_https_if_not_specified
  test_opensearchpy/test_async/test_connection.py:219: PytestWarning: The test <Function test_doesnt_use_https_if_not_specified> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_doesnt_use_https_if_not_specified(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_no_warning_when_using_ssl_context
  test_opensearchpy/test_async/test_connection.py:223: PytestWarning: The test <Function test_no_warning_when_using_ssl_context> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_no_warning_when_using_ssl_context(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_warns_if_using_non_default_ssl_kwargs_with_ssl_context
  test_opensearchpy/test_async/test_connection.py:229: PytestWarning: The test <Function test_warns_if_using_non_default_ssl_kwargs_with_ssl_context> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_warns_if_using_non_default_ssl_kwargs_with_ssl_context(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_given_ca_certs
  test_opensearchpy/test_async/test_connection.py:251: PytestWarning: The test <Function test_uses_given_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_default_ca_certs
  test_opensearchpy/test_async/test_connection.py:258: PytestWarning: The test <Function test_uses_default_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_no_ca_certs
  /Users/user/Documents/code/my/opensearch-py/opensearchpy/_async/http_aiohttp.py:199: UserWarning: Connecting to https://localhost:9200 using SSL with verify_certs=False is insecure.
    warnings.warn(

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_no_ca_certs
  test_opensearchpy/test_async/test_connection.py:265: PytestWarning: The test <Function test_uses_no_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_transport.py::TestTransport::test_add_connection
  test_opensearchpy/test_async/test_transport.py:262: PytestWarning: The test <Function test_add_connection> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_add_connection(self):

test_opensearchpy/test_async/test_helpers/test_index.py::test_settings_are_saved
  test_opensearchpy/test_async/test_helpers/test_index.py:86: PytestWarning: The test <Function test_settings_are_saved> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_settings_are_saved():

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------------------------------------- generated xml file: /Users/user/Documents/code/my/opensearch-py/junit/opensearch-py-junit.xml ----------------------------------------
  • how to write a new test that will not repeat already existing tests (mean test_http_auth_tuple) ?

I'm sorry if I ask a stupid questions :)

@saimedhi
Copy link
Collaborator

@saimedhi thank for your advice. I've already pass through this guide. If I run the command nox -rs test all tests passed and I see next result:

...
=================================================================== 727 passed, 2 skipped, 25 warnings in 42.21s ===================================================================
nox > Session test-3.9 was successful.
nox > Ran multiple sessions:
nox > * test-2.7: skipped
nox > * test-3.4: skipped
nox > * test-3.5: skipped
nox > * test-3.6: skipped
nox > * test-3.7: skipped
nox > * test-3.8: skipped
nox > * test-3.9: success

But it doesn't help me to understand next things:

  • is it ok, so many tracebacks ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129) or not?
  • why I did't see failed test_http_auth, test_http_auth_tuple, test_http_auth_list? All them passed.
  • how to describe all these warnings (is it ok or not?):
================================================================================= warnings summary =================================================================================
test_opensearchpy/test_connection.py::TestUrllib3Connection::test_uses_no_ca_certs
  /Users/user/Documents/code/my/opensearch-py/opensearchpy/connection/http_urllib3.py:199: UserWarning: Connecting to https://localhost:9200 using SSL with verify_certs=False is insecure.
    warnings.warn(

test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
test_opensearchpy/test_serializer.py::TestJSONSerializer::test_serializes_numpy_floats
  /Users/user/Documents/code/my/opensearch-py/test_opensearchpy/test_serializer.py:113: DeprecationWarning: Please use assertRegex instead.
    self.assertRegexpMatches(

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_as_http_auth
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_as_http_auth' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_credentials_is_null
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_credentials_is_null' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_region_is_null
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_region_is_null' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_asyncsigner.py::TestAsyncSigner::test_aws_signer_async_when_service_is_specified
  /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py:550: RuntimeWarning: coroutine 'TestAsyncSigner.test_aws_signer_async_when_service_is_specified' was never awaited
    method()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_opaque_id
  test_opensearchpy/test_async/test_connection.py:96: PytestWarning: The test <Function test_opaque_id> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_opaque_id(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_default_user_agent
  test_opensearchpy/test_async/test_connection.py:150: PytestWarning: The test <Function test_default_user_agent> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_default_user_agent(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_timeout_set
  test_opensearchpy/test_async/test_connection.py:157: PytestWarning: The test <Function test_timeout_set> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_timeout_set(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_keep_alive_is_on_by_default
  test_opensearchpy/test_async/test_connection.py:161: PytestWarning: The test <Function test_keep_alive_is_on_by_default> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_keep_alive_is_on_by_default(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth
  test_opensearchpy/test_async/test_connection.py:169: PytestWarning: The test <Function test_http_auth> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth_tuple
  test_opensearchpy/test_async/test_connection.py:178: PytestWarning: The test <Function test_http_auth_tuple> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth_tuple(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_http_auth_list
  test_opensearchpy/test_async/test_connection.py:187: PytestWarning: The test <Function test_http_auth_list> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_http_auth_list(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_https_if_verify_certs_is_off
  test_opensearchpy/test_async/test_connection.py:196: PytestWarning: The test <Function test_uses_https_if_verify_certs_is_off> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_uses_https_if_verify_certs_is_off(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_doesnt_use_https_if_not_specified
  test_opensearchpy/test_async/test_connection.py:219: PytestWarning: The test <Function test_doesnt_use_https_if_not_specified> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_doesnt_use_https_if_not_specified(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_no_warning_when_using_ssl_context
  test_opensearchpy/test_async/test_connection.py:223: PytestWarning: The test <Function test_no_warning_when_using_ssl_context> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_no_warning_when_using_ssl_context(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_warns_if_using_non_default_ssl_kwargs_with_ssl_context
  test_opensearchpy/test_async/test_connection.py:229: PytestWarning: The test <Function test_warns_if_using_non_default_ssl_kwargs_with_ssl_context> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_warns_if_using_non_default_ssl_kwargs_with_ssl_context(self):

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_given_ca_certs
  test_opensearchpy/test_async/test_connection.py:251: PytestWarning: The test <Function test_uses_given_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_default_ca_certs
  test_opensearchpy/test_async/test_connection.py:258: PytestWarning: The test <Function test_uses_default_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_no_ca_certs
  /Users/user/Documents/code/my/opensearch-py/opensearchpy/_async/http_aiohttp.py:199: UserWarning: Connecting to https://localhost:9200 using SSL with verify_certs=False is insecure.
    warnings.warn(

test_opensearchpy/test_async/test_connection.py::TestAIOHttpConnection::test_uses_no_ca_certs
  test_opensearchpy/test_async/test_connection.py:265: PytestWarning: The test <Function test_uses_no_ca_certs> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @patch("ssl.SSLContext.load_verify_locations")

test_opensearchpy/test_async/test_transport.py::TestTransport::test_add_connection
  test_opensearchpy/test_async/test_transport.py:262: PytestWarning: The test <Function test_add_connection> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_add_connection(self):

test_opensearchpy/test_async/test_helpers/test_index.py::test_settings_are_saved
  test_opensearchpy/test_async/test_helpers/test_index.py:86: PytestWarning: The test <Function test_settings_are_saved> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    def test_settings_are_saved():

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------------------------------------- generated xml file: /Users/user/Documents/code/my/opensearch-py/junit/opensearch-py-junit.xml ----------------------------------------
  • how to write a new test that will not repeat already existing tests (mean test_http_auth_tuple) ?

I'm sorry if I ask a stupid questions :)

Hello @GRomR1, I will take a look at warnings. I have one more suggestion, please run the same tests on main branch and then on your branch. If warnings are also present in main branch then it isn't an issue related to your PR. And also I notice that tests are skipped for all python versions other than 3.9 due to missing python interpreters. Please make sure you test for all python versions. Thanks.

@GRomR1
Copy link
Author

GRomR1 commented May 13, 2023

Ok. When I checkout to the main branch and run tests (via nox -rs test) I've got the same results (also the same warnings).

Please make sure you test for all python versions
Need to install all oldest python version to run test (from 2.7 to 3.9)?

When I run ./.ci/run-tests I didn't see running tests with http_auth in results (mean test_http_auth_tuple test). The output of the command:

test_opensearchpy/test_server/test_clients.py::TestUnicode::test_indices_analyze PASSED [  0%]
test_opensearchpy/test_server/test_clients.py::TestBulk::test_bulk_works_with_bytestring_body PASSED [  0%]
test_opensearchpy/test_server/test_clients.py::TestBulk::test_bulk_works_with_string_body PASSED [  1%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_create_destination SKIPPED (Plugin not supported for opensearch version) [  1%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_create_monitor SKIPPED (Plugin not supported for opensearch version) [  2%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_get_destination SKIPPED (Plugin not supported for opensearch version) [  2%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_get_monitor SKIPPED (Plugin not supported for opensearch version) [  3%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_run_monitor SKIPPED (Plugin not supported for opensearch version) [  3%]
test_opensearchpy/test_server/test_plugins.py::TestAlertingPlugin::test_search_monitor SKIPPED (Plugin not supported for opensearch version) [  4%]
test_opensearchpy/test_server/test_rest_api_spec.py::test_rest_api_spec[test_spec0] SKIPPED (got empty parameter set ['test_spec'], function test_rest_api_spec at /code/opensearch-py/test_opensearchpy/test_server/test_rest_api_spec.py:549) [  4%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_actions_remain_unchanged PASSED [  5%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_all_documents_get_inserted PASSED [  5%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_all_errors_from_chunk_are_raised_on_failure PASSED [  6%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_different_op_types PASSED [  6%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_rejected_documents_are_retried PASSED [  7%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_rejected_documents_are_retried_at_most_max_retries_times PASSED [  7%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_transport_error_can_becaught PASSED [  7%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_transport_error_is_raised_with_max_retries PASSED [  8%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_all_documents_get_inserted PASSED [  8%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_bulk_works_with_single_item PASSED [  9%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_error_is_raised PASSED [  9%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_errors_are_collected_properly PASSED [ 10%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_errors_are_reported_correctly PASSED [ 10%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_ignore_error_if_raised PASSED [ 11%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestBulk::test_stats_only_reports_numbers PASSED [ 11%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_all_documents_are_read PASSED [ 12%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_clear_scroll PASSED [ 12%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_initial_search_error PASSED [ 13%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_logger PASSED [ 13%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_no_scroll_id_fast_route PASSED [ 14%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_order_can_be_preserved PASSED [ 14%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_favor_scroll_kwargs_option PASSED [ 15%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_forwarded PASSED [ 15%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_scroll_error PASSED [ 15%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestScan::test_shards_no_skipped_field PASSED [ 16%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestReindex::test_all_documents_get_moved PASSED [ 16%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestReindex::test_reindex_accepts_a_query PASSED [ 17%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestReindex::test_reindex_passes_kwargs_to_scan_and_bulk PASSED [ 17%]
test_opensearchpy/test_server/test_helpers/test_actions.py::TestParentChildReindex::test_children_are_reindexed_correctly PASSED [ 18%]
test_opensearchpy/test_server/test_helpers/test_analysis.py::test_simulate_with_just__builtin_tokenizer PASSED [ 18%]
test_opensearchpy/test_server/test_helpers/test_analysis.py::test_simulate_complex PASSED [ 19%]
test_opensearchpy/test_server/test_helpers/test_analysis.py::test_simulate_builtin PASSED [ 19%]
test_opensearchpy/test_server/test_helpers/test_count.py::test_count_all PASSED [ 20%]
test_opensearchpy/test_server/test_helpers/test_count.py::test_count_prefetch PASSED [ 20%]
test_opensearchpy/test_server/test_helpers/test_count.py::test_count_filter PASSED [ 21%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_serialization PASSED [ 21%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_nested_inner_hits_are_wrapped_properly PASSED [ 22%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_nested_inner_hits_are_deserialized_properly PASSED [ 22%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_nested_top_hits_are_wrapped_properly PASSED [ 23%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_object_field PASSED [ 23%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_script PASSED [ 23%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_retry_on_conflict PASSED [ 24%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_conflicting_version[None] PASSED [ 24%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_conflicting_version[0] PASSED [ 25%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_save_and_update_return_doc_meta PASSED [ 25%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_init PASSED [ 26%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get_raises_404_on_index_missing PASSED [ 26%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get_raises_404_on_non_existent_id PASSED [ 27%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get_returns_none_if_404_ignored PASSED [ 27%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get_returns_none_if_404_ignored_and_index_doesnt_exist PASSED [ 28%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get PASSED [ 28%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_exists_return_true PASSED [ 29%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_exists_false PASSED [ 29%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_get_with_tz_date PASSED [ 30%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_save_with_tz_date PASSED [ 30%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_mget PASSED [ 30%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_mget_raises_exception_when_missing_param_is_invalid PASSED [ 31%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_mget_raises_404_when_missing_param_is_raise PASSED [ 31%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_mget_ignores_missing_docs_when_missing_param_is_skip PASSED [ 32%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update_works_from_search_response PASSED [ 32%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_update PASSED [ 33%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_save_updates_existing_doc PASSED [ 33%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_save_automatically_uses_seq_no_and_primary_term PASSED [ 34%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_delete_automatically_uses_seq_no_and_primary_term PASSED [ 34%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_can_save_to_different_index PASSED [ 35%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_save_without_skip_empty_will_include_empty_fields PASSED [ 35%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_delete PASSED [ 36%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_search PASSED [ 36%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_search_returns_proper_doc_classes PASSED [ 37%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_refresh_mapping PASSED [ 37%]
test_opensearchpy/test_server/test_helpers/test_document.py::test_highlight_in_meta PASSED [ 38%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_facet_with_custom_metric PASSED [ 38%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_nested_facet PASSED [ 38%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_nested_facet_with_filter PASSED [ 39%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_datehistogram_facet PASSED [ 39%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_boolean_facet PASSED [ 40%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_empty_search_finds_everything PASSED [ 40%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_term_filters_are_shown_as_selected_and_data_is_filtered PASSED [ 41%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_range_filters_are_shown_as_selected_and_data_is_filtered PASSED [ 41%]
test_opensearchpy/test_server/test_helpers/test_faceted_search.py::test_pagination PASSED [ 42%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_index_template_works PASSED [ 42%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_index_can_be_saved_even_with_settings PASSED [ 43%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_index_exists PASSED [ 43%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_index_can_be_created_with_settings_and_mappings PASSED [ 44%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_delete PASSED [ 44%]
test_opensearchpy/test_server/test_helpers/test_index.py::test_multiple_indices_with_same_doc_type_work PASSED [ 45%]
test_opensearchpy/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch PASSED [ 45%]
test_opensearchpy/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch_when_index_already_exists_closed PASSED [ 46%]
test_opensearchpy/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch_when_index_already_exists_with_analysis PASSED [ 46%]
test_opensearchpy/test_server/test_helpers/test_mapping.py::test_mapping_gets_updated_from_opensearch PASSED [ 46%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_filters_aggregation_buckets_are_accessible PASSED [ 47%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_top_hits_are_wrapped_in_response PASSED [ 47%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_inner_hits_are_wrapped_in_response PASSED [ 48%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_scan_respects_doc_types PASSED [ 48%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_scan_iterates_through_all_docs PASSED [ 49%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_response_is_cached PASSED [ 49%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_multi_search PASSED [ 50%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_multi_missing PASSED [ 50%]
test_opensearchpy/test_server/test_helpers/test_search.py::test_raw_subfield_can_be_used_in_aggs PASSED [ 51%]
test_opensearchpy/test_server/test_helpers/test_update_by_query.py::test_update_by_query_no_script PASSED [ 51%]
test_opensearchpy/test_server/test_helpers/test_update_by_query.py::test_update_by_query_with_script PASSED [ 52%]
test_opensearchpy/test_server/test_helpers/test_update_by_query.py::test_delete_by_query_with_script PASSED [ 52%]
test_opensearchpy/test_async/test_server/test_clients.py::TestUnicode::test_indices_analyze PASSED [ 53%]
test_opensearchpy/test_async/test_server/test_clients.py::TestBulk::test_bulk_works_with_string_body PASSED [ 53%]
test_opensearchpy/test_async/test_server/test_clients.py::TestBulk::test_bulk_works_with_bytestring_body PASSED [ 53%]
test_opensearchpy/test_async/test_server/test_clients.py::TestYarlMissing::test_aiohttp_connection_works_without_yarl PASSED [ 54%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_actions_remain_unchanged PASSED [ 54%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_all_documents_get_inserted PASSED [ 55%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_documents_data_types PASSED [ 55%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_all_errors_from_chunk_are_raised_on_failure PASSED [ 56%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_different_op_types PASSED [ 56%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_transport_error_can_becaught PASSED [ 57%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_rejected_documents_are_retried PASSED [ 57%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_rejected_documents_are_retried_at_most_max_retries_times PASSED [ 58%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestStreamingBulk::test_transport_error_is_raised_with_max_retries PASSED [ 58%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_bulk_works_with_single_item PASSED [ 59%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_all_documents_get_inserted PASSED [ 59%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_stats_only_reports_numbers PASSED [ 60%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_errors_are_reported_correctly PASSED [ 60%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_error_is_raised PASSED [ 61%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_ignore_error_if_raised PASSED [ 61%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestBulk::test_errors_are_collected_properly PASSED [ 61%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_order_can_be_preserved PASSED [ 62%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_all_documents_are_read PASSED [ 62%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_scroll_error PASSED [ 63%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_initial_search_error PASSED [ 63%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_no_scroll_id_fast_route PASSED [ 64%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_logger PASSED [ 64%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_clear_scroll PASSED [ 65%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_forwarded[kwargs0] PASSED [ 65%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_forwarded[kwargs1] PASSED [ 66%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_forwarded[kwargs2] PASSED [ 66%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestScan::test_scan_auth_kwargs_favor_scroll_kwargs_option PASSED [ 67%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestReindex::test_reindex_passes_kwargs_to_scan_and_bulk PASSED [ 67%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestReindex::test_reindex_accepts_a_query PASSED [ 68%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestReindex::test_all_documents_get_moved PASSED [ 68%]
test_opensearchpy/test_async/test_server/test_helpers/test_actions.py::TestParentChildReindex::test_children_are_reindexed_correctly PASSED [ 69%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_serialization PASSED [ 69%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_nested_inner_hits_are_wrapped_properly PASSED [ 69%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_nested_inner_hits_are_deserialized_properly PASSED [ 70%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_nested_top_hits_are_wrapped_properly PASSED [ 70%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_object_field PASSED [ 71%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_script PASSED [ 71%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_retry_on_conflict PASSED [ 72%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_conflicting_version[None] PASSED [ 72%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_conflicting_version[0] PASSED [ 73%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_save_and_update_return_doc_meta PASSED [ 73%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_init PASSED [ 74%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get_raises_404_on_index_missing PASSED [ 74%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get_raises_404_on_non_existent_id PASSED [ 75%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get_returns_none_if_404_ignored PASSED [ 75%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get_returns_none_if_404_ignored_and_index_doesnt_exist PASSED [ 76%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get PASSED [ 76%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_exists_return_true PASSED [ 76%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_exists_false PASSED [ 77%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_get_with_tz_date PASSED [ 77%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_save_with_tz_date PASSED [ 78%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_mget PASSED [ 78%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_mget_raises_exception_when_missing_param_is_invalid PASSED [ 79%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_mget_raises_404_when_missing_param_is_raise PASSED [ 79%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_mget_ignores_missing_docs_when_missing_param_is_skip PASSED [ 80%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update_works_from_search_response PASSED [ 80%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_update PASSED [ 81%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_save_updates_existing_doc PASSED [ 81%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_save_automatically_uses_seq_no_and_primary_term PASSED [ 82%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_delete_automatically_uses_seq_no_and_primary_term PASSED [ 82%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_can_save_to_different_index PASSED [ 83%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_save_without_skip_empty_will_include_empty_fields PASSED [ 83%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_delete PASSED [ 84%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_search PASSED [ 84%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_search_returns_proper_doc_classes PASSED [ 84%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_refresh_mapping PASSED [ 85%]
test_opensearchpy/test_async/test_server/test_helpers/test_document.py::test_highlight_in_meta PASSED [ 85%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_facet_with_custom_metric PASSED [ 86%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_nested_facet PASSED [ 86%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_nested_facet_with_filter PASSED [ 87%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_datehistogram_facet PASSED [ 87%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_boolean_facet PASSED [ 88%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_empty_search_finds_everything PASSED [ 88%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_term_filters_are_shown_as_selected_and_data_is_filtered PASSED [ 89%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_range_filters_are_shown_as_selected_and_data_is_filtered PASSED [ 89%]
test_opensearchpy/test_async/test_server/test_helpers/test_faceted_search.py::test_pagination PASSED [ 90%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_index_template_works PASSED [ 90%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_index_can_be_saved_even_with_settings PASSED [ 91%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_index_exists PASSED [ 91%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_index_can_be_created_with_settings_and_mappings PASSED [ 92%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_delete PASSED [ 92%]
test_opensearchpy/test_async/test_server/test_helpers/test_index.py::test_multiple_indices_with_same_doc_type_work PASSED [ 92%]
test_opensearchpy/test_async/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch PASSED [ 93%]
test_opensearchpy/test_async/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch_when_index_already_exists_closed PASSED [ 93%]
test_opensearchpy/test_async/test_server/test_helpers/test_mapping.py::test_mapping_saved_into_opensearch_when_index_already_exists_with_analysis PASSED [ 94%]
test_opensearchpy/test_async/test_server/test_helpers/test_mapping.py::test_mapping_gets_updated_from_opensearch PASSED [ 94%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_filters_aggregation_buckets_are_accessible PASSED [ 95%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_top_hits_are_wrapped_in_response PASSED [ 95%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_inner_hits_are_wrapped_in_response PASSED [ 96%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_scan_respects_doc_types PASSED [ 96%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_scan_iterates_through_all_docs PASSED [ 97%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_multi_search PASSED [ 97%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_multi_missing PASSED [ 98%]
test_opensearchpy/test_async/test_server/test_helpers/test_search.py::test_raw_subfield_can_be_used_in_aggs PASSED [ 98%]
test_opensearchpy/test_async/test_server/test_helpers/test_update_by_query.py::test_update_by_query_no_script PASSED [ 99%]
test_opensearchpy/test_async/test_server/test_helpers/test_update_by_query.py::test_update_by_query_with_script PASSED [ 99%]
test_opensearchpy/test_async/test_server/test_helpers/test_update_by_query.py::test_delete_by_query_with_script PASSED [100%]

=============================== warnings summary ===============================
test_opensearchpy/test_server/test_rest_api_spec.py:545
  /code/opensearch-py/test_opensearchpy/test_server/test_rest_api_spec.py:545: UserWarning: Could not load REST API tests: 'version'
    warnings.warn("Could not load REST API tests: %s" % (str(e),))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---- generated xml file: /code/opensearch-py/junit/opensearch-py-junit.xml -----

---------- coverage: platform linux, python 3.9.16-final-0 -----------
Coverage XML written to file /code/opensearch-py/junit/opensearch-py-codecov.xml

================== 206 passed, 7 skipped, 1 warning in 39.62s ==================
Fetching opensearch repo...
INFO: clean the network if not detached (start and exit)
INFO: Removing container instance
instance
INFO: Removing volume instance-rest-test-data
INFO: Removing volume instance-rest-test-data
instance-rest-test-data
INFO: Removing network search-rest-test
search-rest-test
SUCCESS: Cleaned up and exiting

SUCCESS run-tests

@saimedhi
Copy link
Collaborator

saimedhi commented Jun 5, 2023

Need to install all oldest python version to run test (from 2.7 to 3.9)?

Ideally, we need to install all python versions. But I suggest to test for 2.7 and some other python version greater than 3.5.

When I run ./.ci/run-tests I didn't see running tests with http_auth in results (mean test_http_auth_tuple test).

Please use nox -rs test and I noticed all the http_auth tests are passing.

How to write a new test that will not repeat already existing tests (mean test_http_auth_tuple) ?

Please go through all the tests related to http_auth. Let us know if you find that your change is covered or tested in any of the current tests. Write brief tests that are similar to the ones already in place if you see that your modifications have not been tested.

@GRomR1
Copy link
Author

GRomR1 commented Jul 16, 2023

@dblock am I right this is not actually anymore?

Because #424 will fix the main problem with async methods.

May be need to close this PR and issue?

@saimedhi saimedhi closed this Jul 16, 2023
@saimedhi saimedhi reopened this Jul 16, 2023
@dblock
Copy link
Member

dblock commented Jul 17, 2023

@saimedhi @GRomR1 anything left here?

@saimedhi
Copy link
Collaborator

Didn't notice anything missing.

@dblock dblock closed this Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] async client with basic http_auth results throw an error (TypeError) #283
3 participants