Skip to content

Commit

Permalink
Added support for OPENSEARCH_INITIAL_ADMIN_PASSWORD with OpenSearch 2…
Browse files Browse the repository at this point in the history
….12/13.

Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Apr 18, 2024
1 parent 7d11085 commit 2a1552c
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 6 deletions.
97 changes: 92 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ jobs:
runs-on: ubuntu-latest
services:
search-server:
image: opensearchproject/opensearch:2.6.0
image: opensearchproject/opensearch:2.13.0
ports:
- 9200:9200
env:
discovery.type: single-node
plugins.security.disabled: 'true'
plugins.security.disabled: true
OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123!

steps:
- name: Checkout
Expand Down Expand Up @@ -130,8 +131,8 @@ jobs:
run: |
composer run unit
integration-test:
name: Tntegration Test
integration-test-elasticsearch:
name: Tntegration Test (Elasticsearch)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -140,6 +141,48 @@ jobs:
- ubuntu-latest
search-server-image:
- docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.0
services:
search-server:
image: ${{ matrix.search-server-image }}
ports:
- 9200:9200
env:
discovery.type: single-node

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist
- name: Wait for Search server
run: php ./.github/wait_for_opensearch.php

- name: Integration tests
run: |
composer run integration
env:
OPENSEARCH_URL: 'http://localhost:9200'

integration-test-opensearch:
name: Tntegration Test (OpenSearch)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
search-server-image:
- opensearchproject/opensearch:1.1.0
- opensearchproject/opensearch:1.2.4
- opensearchproject/opensearch:1.3.15
Expand All @@ -156,6 +199,49 @@ jobs:
- opensearchproject/opensearch:2.9.0
- opensearchproject/opensearch:2.10.0
- opensearchproject/opensearch:2.11.1
services:
search-server:
image: ${{ matrix.search-server-image }}
ports:
- 9200:9200
env:
discovery.type: single-node
plugins.security.disabled: true

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --prefer-dist
- name: Wait for Search server
run: php ./.github/wait_for_opensearch.php

- name: Integration tests
run: |
composer run integration
env:
OPENSEARCH_URL: 'http://localhost:9200'

integration-test-opensearch-strong-password:
name: Tntegration Test (OpenSearch w/Strong Password)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
search-server-image:
- opensearchproject/opensearch:2.12.0
- opensearchproject/opensearch:2.13.0
services:
Expand All @@ -165,7 +251,8 @@ jobs:
- 9200:9200
env:
discovery.type: single-node
plugins.security.disabled: '${{ contains(matrix.search-server-image, ''opensearch'') && ''true'' || '''' }}'
plugins.security.disabled: true
OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123!

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
tar xf opensearch-min-*
echo "discovery.type: single-node" >> ./opensearch-*/config/opensearch.yml
./opensearch-*/bin/opensearch &
for attempt in {1..20}; do sleep 5; if curl -s localhost:9200; then echo '=====> ready'; break; fi; echo '=====> waiting...'; done
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added Windows and MacOS support ([#100](https://github.com/opensearch-project/opensearch-php/pull/100))
- Added code coverage reporting ([#100](https://github.com/opensearch-project/opensearch-php/pull/100))
- Added support for a custom signing service name for AWS SigV4 ([#117](https://github.com/opensearch-project/opensearch-php/pull/117))
- Added support for OpenSearch 2.12 and 2.13 ([#180](https://github.com/opensearch-project/opensearch-php/pull/180))

### Changed

Expand Down
5 changes: 4 additions & 1 deletion tests/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public static function getHost(): ?string
if (false !== $url) {
return $url;
}
return 'https://admin:admin@localhost:9200';

$password = getenv('OPENSEARCH_INITIAL_ADMIN_PASSWORD') ?: 'admin';

return 'https://admin:' . $password . '@localhost:9200';
}

/**
Expand Down

0 comments on commit 2a1552c

Please sign in to comment.