From e02b5b824143a6321a628135cb2cecd8a13b16cb Mon Sep 17 00:00:00 2001 From: "J. Liu" Date: Tue, 11 Apr 2023 10:51:01 -0400 Subject: [PATCH] test(fix): add conformance test to the CI pipeline (redo of PR#1698). (#1699) --- .github/workflows/conformance.yaml | 41 +++++++++++++++++++ .kokoro/conformance.sh | 65 ++++++++++++++++++++++++++++++ test-proxy/known_failures.txt | 1 + 3 files changed, 107 insertions(+) create mode 100644 .github/workflows/conformance.yaml create mode 100755 .kokoro/conformance.sh create mode 100644 test-proxy/known_failures.txt diff --git a/.github/workflows/conformance.yaml b/.github/workflows/conformance.yaml new file mode 100644 index 0000000000..b17c0014e6 --- /dev/null +++ b/.github/workflows/conformance.yaml @@ -0,0 +1,41 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + push: + branches: + - main + pull_request: +name: conformance +jobs: + conformance: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + with: + repository: googleapis/cloud-bigtable-clients-test + ref: main + path: cloud-bigtable-clients-test + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 8 + - uses: actions/setup-go@v3 + with: + go-version: '>=1.20.2' + - run: java -version + - run: go version + - run: .kokoro/conformance.sh diff --git a/.kokoro/conformance.sh b/.kokoro/conformance.sh new file mode 100755 index 0000000000..41405ef858 --- /dev/null +++ b/.kokoro/conformance.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +RETURN_CODE=0 +set +e + +# Build and start the proxy in a separate process +pushd . +cd test-proxy +mvn clean install -DskipTests +nohup java -Dport=9999 -jar target/google-cloud-bigtable-test-proxy-0.0.1-SNAPSHOT.jar & +proxyPID=$! +popd + +# Run the conformance test +pushd . +cd cloud-bigtable-clients-test/tests +eval "go test -v -skip `cat ../../test-proxy/known_failures.txt` -proxy_addr=:9999" +RETURN_CODE=$? +popd + +# Stop the proxy +kill $proxyPID + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/test-proxy/known_failures.txt b/test-proxy/known_failures.txt new file mode 100644 index 0000000000..ba99db16b4 --- /dev/null +++ b/test-proxy/known_failures.txt @@ -0,0 +1 @@ +TestMutateRow_Generic_DeadlineExceeded\|TestMutateRows_Retry_ExponentialBackoff\|TestSampleRowKeys_Generic_DeadlineExceeded