From e14fb59fa7582521f84d5283e39c0aeb86fb3a45 Mon Sep 17 00:00:00 2001 From: "Daniel Doubrovkine (dB.)" Date: Tue, 3 May 2022 12:00:57 -0400 Subject: [PATCH] Re-enable integration tests across multiple versions of OpenSearch (#154) * Re-add integration tests with OpenSeearch 1.x. Signed-off-by: dblock * Fix: make test compatible with OpenSearch 1.x and 2.x. Signed-off-by: dblock * Re-add the complete test matrix. Signed-off-by: dblock * Increment version to 2.0.0. Signed-off-by: dblock * Added 2.0 compatibility matrix. Signed-off-by: dblock * Removed unused OPENSEARCH_VERSION. Signed-off-by: dblock * Removed java-client. Signed-off-by: dblock * Added OpenSearch 1.3.1. Signed-off-by: dblock * Added Java 17 for main. Signed-off-by: dblock --- .../workflows/test-integration-unreleased.yml | 19 +++++++++++-------- .github/workflows/test-integration.yml | 16 ++++++++++------ COMPATIBILITY.md | 8 +++++++- config/version.txt | 2 +- .../client/opensearch/integTest/CrudIT.java | 9 ++++----- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test-integration-unreleased.yml b/.github/workflows/test-integration-unreleased.yml index 7ed99612ce..a136ed906c 100644 --- a/.github/workflows/test-integration-unreleased.yml +++ b/.github/workflows/test-integration-unreleased.yml @@ -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 diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 8cdb326664..1caac954e6 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -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 \ No newline at end of file diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md index 64477292be..2ed138ca75 100644 --- a/COMPATIBILITY.md +++ b/COMPATIBILITY.md @@ -1,4 +1,5 @@ - [Compatibility with OpenSearch](#compatibility-with-opensearch) +- [Upgrading](#upgrading) ## Compatibility with OpenSearch @@ -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 | \ No newline at end of file +| 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. \ No newline at end of file diff --git a/config/version.txt b/config/version.txt index 3eefcb9dd5..227cea2156 100644 --- a/config/version.txt +++ b/config/version.txt @@ -1 +1 @@ -1.0.0 +2.0.0 diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java index dbdf43ce29..1fee8b7a77 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/CrudIT.java @@ -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()); } }