Skip to content

Commit

Permalink
Re-enable integration tests across multiple versions of OpenSearch (o…
Browse files Browse the repository at this point in the history
…pensearch-project#154)

* Re-add integration tests with OpenSeearch 1.x.

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

* Fix: make test compatible with OpenSearch 1.x and 2.x.

Signed-off-by: dblock <dblock@dblock.org>

* Re-add the complete test matrix.

Signed-off-by: dblock <dblock@dblock.org>

* Increment version to 2.0.0.

Signed-off-by: dblock <dblock@dblock.org>

* Added 2.0 compatibility matrix.

Signed-off-by: dblock <dblock@dblock.org>

* Removed unused OPENSEARCH_VERSION.

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

* Removed java-client.

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

* Added OpenSearch 1.3.1.

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

* Added Java 17 for main.

Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock authored May 3, 2022
1 parent adb8c56 commit e14fb59
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 21 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/test-integration-unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@ on:
branches:
- "main"

env:
OPENSEARCH_VERSION: '2.0'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 11 ]
entry:
- { opensearch_ref: '1.x', java: 11 }
- { opensearch_ref: '2.x', java: 11 }
- { opensearch_ref: '2.x', java: 17 }
- { opensearch_ref: '2.0', java: 11 }
- { opensearch_ref: 'main', java: 11 }
- { opensearch_ref: 'main', java: 17 }
steps:
- name: Set up JDK ${{ matrix.java }}
- name: Set up JDK ${{ matrix.entry.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
java-version: ${{ matrix.entry.java }}

- name: Checkout OpenSearch
uses: actions/checkout@v2
with:
repository: opensearch-project/opensearch
ref: ${{ env.OPENSEARCH_VERSION }}
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch

- name: Assemble OpenSearch
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,33 @@ jobs:
fail-fast: false
matrix:
entry:
- { opensearch_version: "", java: 11 }
- { opensearch_version: 1.0.0, java: 11 }
- { opensearch_version: 1.0.1, java: 11 }
- { opensearch_version: 1.1.0, java: 11 }
- { opensearch_version: 1.2.0, java: 11 }
- { opensearch_version: 1.2.1, java: 11 }
- { opensearch_version: 1.2.2, java: 11 }
- { opensearch_version: 1.2.3, java: 11 }
- { opensearch_version: 1.2.4, java: 11 }
- { opensearch_version: 1.3.0, java: 11 }
- { opensearch_version: 1.3.1, java: 11 }
steps:
- name: Set up JDK ${{ matrix.java }}
if: ${{ matrix.entry.opensearch_version != ''}}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.entry.java }}

- name: Checkout Branch
if: ${{ matrix.entry.opensearch_version != ''}}
uses: actions/checkout@v2

- name: Run Docker
if: ${{ matrix.entry.opensearch_version != ''}}
run: |
docker-compose --project-directory .ci/opensearch build --build-arg OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
docker-compose --project-directory .ci/opensearch up -d
sleep 60
- name: Run Integration Test
if: ${{ matrix.entry.opensearch_version != ''}}
run: ./gradlew clean integrationTest

- name: Stop Docker
if: ${{ matrix.entry.opensearch_version != ''}}
run: |
docker-compose --project-directory .ci/opensearch down
8 changes: 7 additions & 1 deletion COMPATIBILITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- [Compatibility with OpenSearch](#compatibility-with-opensearch)
- [Upgrading](#upgrading)

## Compatibility with OpenSearch

Expand All @@ -15,4 +16,9 @@ The below matrix shows the compatibility of the [`opensearch-java-client`](https
| 1.2.3 | 1.0.0 |
| 1.2.4 | 1.0.0 |
| 1.3.0 | 1.0.0 |
| 1.3.1 | 1.0.0 |
| 1.3.1 | 1.0.0 |
| 2.0.0 | 2.0.0 |

## Upgrading

Major versions of OpenSearch introduce breaking changes that require careful upgrades of the client. While `opensearch-java-client` 2.0.0 works against OpenSearch 1.3.1, certain deprecated features removed in OpenSearch 2.0 have also been removed from the client. Please refer to the [OpenSearch documentation](https://opensearch.org/docs/latest/clients/index/) for more information.
2 changes: 1 addition & 1 deletion config/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
2.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,10 @@ public void testUpdate() throws Exception {
try {
highLevelClient().update(updateRequest, AppData.class);
} catch (OpenSearchException e) {
assertEquals(
"Request failed: [document_missing_exception] " +
"[does_not_exist]: document missing",
e.getMessage()
);
// 1.x: [document_missing_exception] [_doc][does_not_exist]: document missing
// 2.x: [document_missing_exception] [does_not_exist]: document missing
assertTrue(e.getMessage().contains("[document_missing_exception]"));
assertTrue(e.getMessage().contains("[does_not_exist]: document missing"));
assertEquals(404, e.status());
}
}
Expand Down

0 comments on commit e14fb59

Please sign in to comment.