Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Adds newer OpenSearch builds to integration tests and updates unreleased wait mechanism

Signed-off-by: dblock <dblock@amazon.com>

* Display OpenSearch version in integration tests.

Signed-off-by: dblock <dblock@amazon.com>

* Added support for OPENSEARCH_INITIAL_ADMIN_PASSWORD with OpenSearch 2.12/13.

Signed-off-by: dblock <dblock@amazon.com>

* Set discovery.type.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
  • Loading branch information
dblock and harshavamsi authored Apr 19, 2024
1 parent 8962f02 commit 9d164d4
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .github/wait_for_es.php → .github/wait_for_opensearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
try {
$client = ClientBuilder::create()->build();
$client->ping();
echo 'Is up and running' . PHP_EOL;
$info = $client->info();
echo 'OpenSearch ' . $info['version']['number'] . ' is up and running' . PHP_EOL;
exit(0);
} catch (Throwable $e) {
if ($retries === $maxRetries) {
Expand Down
141 changes: 120 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -35,12 +35,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -58,21 +58,22 @@ jobs:
runs-on: ubuntu-latest
services:
search-server:
image: opensearchproject/opensearch:2.2.1
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
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: yaml, zip, curl, pcov
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -82,7 +83,7 @@ jobs:
composer install --prefer-dist
- name: Wait for Search server
run: php ./.github/wait_for_es.php
run: php ./.github/wait_for_opensearch.php

- name: PHPUnit
run: |
Expand Down Expand Up @@ -112,7 +113,7 @@ jobs:
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
Expand All @@ -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,29 +141,127 @@ 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.6
- opensearchproject/opensearch:1.3.15
- opensearchproject/opensearch:2.0.1
- opensearchproject/opensearch:2.1.0
- opensearchproject/opensearch:2.2.1
- opensearchproject/opensearch:2.5.0
- opensearchproject/opensearch:2.3.0
- opensearchproject/opensearch:2.4.1
- opensearchproject/opensearch:2.5.0
- opensearchproject/opensearch:2.6.0
- opensearchproject/opensearch:2.7.0
- opensearchproject/opensearch:2.8.0
- 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:
search-server:
image: ${{ matrix.search-server-image }}
ports:
- 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
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -172,7 +271,7 @@ jobs:
composer install --prefer-dist
- name: Wait for Search server
run: php ./.github/wait_for_es.php
run: php ./.github/wait_for_opensearch.php

- name: Integration tests
run: |
Expand Down
67 changes: 41 additions & 26 deletions .github/workflows/test_unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,15 @@ jobs:
strategy:
fail-fast: false
matrix:
entry:
- { opensearch_ref: '1.x' }
- { opensearch_ref: '2.0' }
- { opensearch_ref: '2.x' }
- { opensearch_ref: 'main' }
opensearch_ref: [ '1.x', '2.x', '2.0', 'main' ]
steps:
- name: Checkout OpenSearch
uses: actions/checkout@v2
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch

- name: Assemble OpenSearch
run: |
cd opensearch
./gradlew assemble
# This step runs the docker image generated during gradle assemble in OpenSearch. It is tagged as opensearch:test.
# Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190
- name: Run Docker Image
run: |
docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test
sleep 90
- name: Checkout PHP Client
uses: actions/checkout@v2

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
extensions: yaml, zip, curl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -53,8 +31,45 @@ jobs:
run: |
composer install --prefer-dist
- name: Checkout OpenSearch
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.opensearch_ref }}
path: opensearch

- name: Get OpenSearch branch top
id: get-key
working-directory: opensearch
run: echo key=`git log -1 --format='%H'` >> $GITHUB_OUTPUT

- name: Restore cached build
id: cache-restore
uses: actions/cache/restore@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- name: Assemble OpenSearch
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: opensearch
run: ./gradlew :distribution:archives:linux-tar:assemble

- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- name: Run OpenSearch
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
tar xf opensearch-min-*
./opensearch-*/bin/opensearch -d
- name: Wait for Search server
run: php ./.github/wait_for_es.php
run: php ./.github/wait_for_opensearch.php

- name: Integration tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
with:
fetch-depth: 0

- name: Use PHP 8.1
- name: Use PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
24 changes: 13 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
# CHANGELOG

Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Added
- Added PHP 8.2 to the CI
- Github workflow for changelog verification ([#92](https://github.com/opensearch-project/opensearch-php/pull/92))
- Added a GitHub workflow for verifying CHANGELOG ([#92](https://github.com/opensearch-project/opensearch-php/pull/92))
- Added class docs generator ([#96](https://github.com/opensearch-project/opensearch-php/pull/96))
- Added support for Amazon OpenSearch Serverless SigV4 signing ([#119](https://github.com/opensearch-project/opensearch-php/pull/119))
- Added `includePortInHostHeader` option to `ClientBuilder::fromConfig` ([#118](https://github.com/opensearch-project/opensearch-php/pull/118))
- Added the `RefreshSearchAnalyzers` endpoint ([[#152](https://github.com/opensearch-project/opensearch-php/issues/152))
- Added support for `format` parameter to specify the sql response format ([#161](https://github.com/opensearch-project/opensearch-php/pull/161))
- Added ml commons model, model group and connector APIs ([#170](https://github.com/opensearch-project/opensearch-php/pull/170))
- [Feature] Send raw json request ([#171](https://github.com/opensearch-project/opensearch-php/pull/177))
- Added ml-commons model, model group and connector APIs ([#170](https://github.com/opensearch-project/opensearch-php/pull/170))
- Added support for sending raw JSON requests ([#171](https://github.com/opensearch-project/opensearch-php/pull/177))
- Added PHP 8.2 support ([#87](https://github.com/opensearch-project/opensearch-php/issues/87))
- 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

- Added Windows and macOS jobs to CI
- Added Coverage reporting to Codecov
- Support a custom signing service name for AWS SigV4 ([#117](https://github.com/opensearch-project/opensearch-php/pull/117))

### Deprecated

### Removed

### Fixed
- Updated backport helper version and add fix to backport workflow when tag is applied before closing PR ([#131](https://github.com/opensearch-project/opensearch-php/pull/131))

- Fixed backport workflow when tag is applied before closing PR ([#131](https://github.com/opensearch-project/opensearch-php/pull/131))
- Fixed host urls with trailing slash in the url ([#130](https://github.com/opensearch-project/opensearch-php/pull/140))
- Fixed point-in-time APIs ([#142](https://github.com/opensearch-project/opensearch-php/pull/142))
- Fixed bug in ClientBuilder where basic authentication is overridden by connection params ([#160](https://github.com/opensearch-project/opensearch-php/pull/160))
- Fixed basic authentication being overridden by connection params in `ClientBuilder` ([#160](https://github.com/opensearch-project/opensearch-php/pull/160))
- Fixed PHP warning in `Connection::tryDeserializeError()` for some error responses ([#167](https://github.com/opensearch-project/opensearch-php/issues/167))

### Security


[Unreleased]: https://github.com/opensearch-project/opensearch-php/compare/2.0...HEAD
Loading

0 comments on commit 9d164d4

Please sign in to comment.