Skip to content

Commit

Permalink
Try passing through
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho committed Jun 18, 2024
1 parent ac76aae commit e5cd848
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,27 @@ docker build \
echo -e "\033[1m>>>>> Run [opensearch-project/opensearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"

mkdir -p junit
docker run \

OPENSEARCH_REQUIRED_VERSION="2.12.0"
# Starting in 2.12.0, security demo configuration script requires an initial admin password
COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
docker run \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "OPENSEARCH_URL=${opensearch_url}" \
--env "OPENSEARCH_VERSION=${OPENSEARCH_VERSION}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--env "TEST_TYPE=server" \
--env "TEST_PATTERN=${TEST_PATTERN}" \
--env "OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin" \
--name opensearch-py \
--rm \
opensearch-project/opensearch-py \
python setup.py test
else
docker run \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "OPENSEARCH_URL=${opensearch_url}" \
Expand All @@ -44,5 +64,6 @@ docker run \
--rm \
opensearch-project/opensearch-py \
python setup.py test
fi

unset TEST_PATTERN
4 changes: 3 additions & 1 deletion test_opensearchpy/test_server_secured/test_clients.py
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
from unittest import TestCase

from opensearchpy import OpenSearch
Expand All @@ -15,9 +16,10 @@

class TestSecurity(TestCase):
def test_security(self) -> None:
password = os.environ.get("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "admin")
client = OpenSearch(
OPENSEARCH_URL,
http_auth=("admin", "admin"),
http_auth=("admin", password),
verify_certs=False,
)

Expand Down

0 comments on commit e5cd848

Please sign in to comment.