Skip to content

Commit

Permalink
Fixed remaining references to admin:admin.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 15, 2024
1 parent 9996bb9 commit 92e8749
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Added
### Changed
- Removed deprecated `numpy.float_` and update NumPy/Pandas imports ([#762](https://github.com/opensearch-project/opensearch-py/pull/762))
- Removed workaround for [aiohttp#1769](https://github.com/aio-libs/aiohttp/issues/1769) ([#794](https://github.com/opensearch-project/opensearch-py/pull/794))
### Deprecated
### Removed
- Removed redundant dependency on six ([#781](https://github.com/opensearch-project/opensearch-py/pull/781))
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/bench_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# GitHub history for details.

import asyncio
import os
import uuid
from typing import Any

Expand Down Expand Up @@ -42,7 +43,7 @@ async def test_async(client_count: int = 1, item_count: int = 1) -> None:
"""
host = "localhost"
port = 9200
auth = ("admin", "admin")
auth = ("admin", os.getenv("OPENSEARCH_PASSWORD", "admin"))
index_name = "test-index-async"

clients = []
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/bench_info_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


import logging
import os
import sys
import time
from typing import Any
Expand All @@ -34,7 +35,7 @@ def test(thread_count: int = 1, request_count: int = 1, client_count: int = 1) -
"""test to index with thread_count threads, item_count records and run client_count clients"""
host = "localhost"
port = 9200
auth = ("admin", "admin")
auth = ("admin", os.getenv("OPENSEARCH_PASSWORD", "admin"))

root = logging.getLogger()
# root.setLevel(logging.DEBUG)
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/bench_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import json
import logging
import os
import sys
import time
import uuid
Expand Down Expand Up @@ -52,7 +53,7 @@ def test(thread_count: int = 1, item_count: int = 1, client_count: int = 1) -> N
"""test to index with thread_count threads, item_count records and run client_count clients"""
host = "localhost"
port = 9200
auth = ("admin", "admin")
auth = ("admin", os.getenv("OPENSEARCH_PASSWORD", "admin"))
index_name = "test-index-sync"

root = logging.getLogger()
Expand Down
2 changes: 1 addition & 1 deletion opensearchpy/_async/helpers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from opensearchpy import AsyncOpenSearch
from opensearchpy.exceptions import ConnectionError

OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL", "https://admin:admin@localhost:9200")
OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL", "https://localhost:9200")

Check warning on line 18 in opensearchpy/_async/helpers/test.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/_async/helpers/test.py#L18

Added line #L18 was not covered by tests


async def get_test_client(nowait: bool = False, **kwargs: Any) -> Any:
Expand Down
11 changes: 6 additions & 5 deletions opensearchpy/helpers/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from opensearchpy import OpenSearch
from opensearchpy.exceptions import ConnectionError

OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL", "https://admin:admin@localhost:9200")
OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL", "https://localhost:9200")

Check warning on line 37 in opensearchpy/helpers/test.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/helpers/test.py#L37

Added line #L37 was not covered by tests


def get_test_client(nowait: bool = False, **kwargs: Any) -> OpenSearch:
Expand Down Expand Up @@ -105,10 +105,11 @@ def opensearch_version(client: opensearchpy.client.OpenSearch) -> Any:
if "OPENSEARCH_VERSION" in os.environ:
OPENSEARCH_VERSION = _get_version(os.environ["OPENSEARCH_VERSION"])
else:
client = OpenSearch(
OPENSEARCH_URL,
verify_certs=False,
OPENSEARCH_VERSION = opensearch_version(

Check warning on line 108 in opensearchpy/helpers/test.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/helpers/test.py#L108

Added line #L108 was not covered by tests
get_test_client(
verify_certs=False,
http_auth=("admin", os.getenv("OPENSEARCH_PASSWORD", "admin")),
)
)
OPENSEARCH_VERSION = opensearch_version(client)

__all__ = ["OpenSearchTestCase"]
2 changes: 1 addition & 1 deletion samples/logging/log_collection_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main() -> None:
# Setup connection with the OpenSearch cluster
print("Setting up connection with OpenSearch cluster...")
opensearch_client: Any = OpenSearch(
"https://admin:admin@localhost:9200",
"https://localhost:9200",
use_ssl=True,
verify_certs=False,
ssl_show_warn=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

import os
import re
from datetime import datetime
from typing import Any
Expand Down Expand Up @@ -36,7 +37,10 @@

@fixture(scope="function") # type: ignore
async def client() -> Any:
client = await get_test_client(verify_certs=False, http_auth=("admin", "admin"))
client = await get_test_client(
verify_certs=False,
http_auth=("admin", os.getenv("OPENSEARCH_PASSWORD", "admin")),
)
await add_connection("default", client)
return client

Expand Down
6 changes: 5 additions & 1 deletion test_opensearchpy/test_server/test_helpers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# specific language governing permissions and limitations
# under the License.

import os
import re
from datetime import datetime
from typing import Any
Expand All @@ -46,7 +47,10 @@

@fixture(scope="session") # type: ignore
def client() -> Any:
client = get_test_client(verify_certs=False, http_auth=("admin", "admin"))
client = get_test_client(
verify_certs=False,
http_auth=("admin", os.getenv("OPENSEARCH_PASSWORD", "admin")),
)
add_connection("default", client)
return client

Expand Down

0 comments on commit 92e8749

Please sign in to comment.