From 93978626eba0eee0ddc45c7f2d8749f817c32945 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Tue, 24 May 2022 12:43:51 -0700 Subject: [PATCH 1/2] Add support to run tests against unreleased OpenSearch Signed-off-by: Vacha Shah --- .ci/run-opensearch.sh | 24 +++++--- .../test-integrations-unreleased.yml | 55 +++++++++++++++++++ 2 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test-integrations-unreleased.yml diff --git a/.ci/run-opensearch.sh b/.ci/run-opensearch.sh index 4671f662..9b137dc5 100755 --- a/.ci/run-opensearch.sh +++ b/.ci/run-opensearch.sh @@ -54,14 +54,20 @@ END local_detach="true" if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi - echo -e "\033[34;1mINFO: building $CLUSTER container\033[0m" - echo 'cluster is' $CLUSTER - docker build \ - --file=.ci/$CLUSTER/Dockerfile \ - --build-arg SECURE_INTEGRATION=$SECURE_INTEGRATION \ - --build-arg STACK_VERSION=$STACK_VERSION \ - --tag=$CLUSTER-secure-$SECURE_INTEGRATION \ - . + CLUSTER_TAG=$CLUSTER + if [[ "$STACK_VERSION" != *"SNAPSHOT" ]]; then + CLUSTER_TAG=$CLUSTER-secure-$SECURE_INTEGRATION + echo -e "\033[34;1mINFO: building $CLUSTER container\033[0m" + echo 'cluster is' $CLUSTER + docker build \ + --file=.ci/$CLUSTER/Dockerfile \ + --build-arg SECURE_INTEGRATION=$SECURE_INTEGRATION \ + --build-arg STACK_VERSION=$STACK_VERSION \ + --tag=$CLUSTER_TAG \ + . + else + CLUSTER_TAG=$CLUSTER_TAG:test + fi echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m" set -x @@ -87,7 +93,7 @@ END --health-timeout=2s \ --rm \ -d \ - $CLUSTER-secure-$SECURE_INTEGRATION; + $CLUSTER_TAG; set +x if wait_for_container "$opensearch_node_name" "$network_name"; then diff --git a/.github/workflows/test-integrations-unreleased.yml b/.github/workflows/test-integrations-unreleased.yml new file mode 100644 index 00000000..a78928ba --- /dev/null +++ b/.github/workflows/test-integrations-unreleased.yml @@ -0,0 +1,55 @@ +name: Integration with Unreleased OpenSearch + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + entry: + - { opensearch_ref: '1.x' } + - { opensearch_ref: '2.0' } + - { opensearch_ref: '2.x' } + - { opensearch_ref: 'main' } + steps: + - name: Checkout OpenSearch + uses: actions/checkout@v2 + with: + repository: opensearch-project/opensearch + ref: ${{ matrix.entry.opensearch_ref }} + path: opensearch + + # This step builds the docker image tagged as opensearch:test. It will be further used in /ci/run-tests to test against unreleased OpenSearch. + # Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190 + - name: Assemble OpenSearch + run: | + cd opensearch + ./gradlew assemble + + - name: Checkout Rust Client + uses: actions/checkout@v2 + + - name: Increase system limits + run: | + sudo swapoff -a + sudo sysctl -w vm.swappiness=1 + sudo sysctl -w fs.file-max=262144 + sudo sysctl -w vm.max_map_count=262144 + + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + components: rustfmt, clippy + + - name: Integ OpenSearch ${{ matrix.entry.opensearch_ref }} secured=false + run: "./.ci/run-tests opensearch SNAPSHOT false" \ No newline at end of file From 6dd653e8329cc9966e6af31a12f8734b6a094bbc Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Tue, 24 May 2022 14:20:53 -0700 Subject: [PATCH 2/2] Run workflow on all branches Signed-off-by: Vacha Shah --- .github/workflows/test-integrations-unreleased.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test-integrations-unreleased.yml b/.github/workflows/test-integrations-unreleased.yml index a78928ba..4835e00f 100644 --- a/.github/workflows/test-integrations-unreleased.yml +++ b/.github/workflows/test-integrations-unreleased.yml @@ -1,12 +1,6 @@ name: Integration with Unreleased OpenSearch -on: - push: - branches: - - "main" - pull_request: - branches: - - "main" +on: [push, pull_request] jobs: test: