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 481167f
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 5 deletions.
94 changes: 90 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
services:
search-server:
image: opensearchproject/opensearch:2.6.0
image: opensearchproject/opensearch:2.13.0
ports:
- 9200:9200
env:
Expand Down Expand Up @@ -130,8 +130,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 +140,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 +198,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 +250,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: 89427a9dbcda9ad84d0374b870eb7238

steps:
- name: Checkout
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 481167f

Please sign in to comment.