|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2023 Google LLC |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +# Fail on any error |
| 18 | +set -eo pipefail |
| 19 | + |
| 20 | +# Display commands being run |
| 21 | +set -x |
| 22 | + |
| 23 | +## cd to the parent directory, i.e. the root of the git repo |
| 24 | +cd $(dirname $0)/../.. |
| 25 | + |
| 26 | +rootDir=$(pwd) |
| 27 | +clientLibHome=$rootDir/google-cloud-go/bigtable |
| 28 | +testProxyHome=$clientLibHome/internal/testproxy |
| 29 | +testProxyPort=9999 |
| 30 | +conformanceTestsHome=$rootDir/cloud-bigtable-clients-test/tests |
| 31 | + |
| 32 | +sponge_log=$clientLibHome/sponge_log.log |
| 33 | + |
| 34 | +cd $testProxyHome |
| 35 | +go build |
| 36 | + |
| 37 | +nohup $testProxyHome/testproxy --port $testProxyPort & |
| 38 | +proxyPID=$! |
| 39 | + |
| 40 | +# Stop the testproxy |
| 41 | +function cleanup() { |
| 42 | + echo "Cleanup testproxy and move logs" |
| 43 | + kill -9 $proxyPID |
| 44 | + # Takes the kokoro output log (raw stdout) and creates a machine-parseable |
| 45 | + # xUnit XML file. |
| 46 | + cat $sponge_log | |
| 47 | + go-junit-report -set-exit-code >$clientLibHome/sponge_log.xml |
| 48 | +} |
| 49 | +trap cleanup EXIT |
| 50 | + |
| 51 | +# Run the conformance tests |
| 52 | +cd $conformanceTestsHome |
| 53 | +# Tests in https://github.com/googleapis/cloud-bigtable-clients-test/tree/main/tests can only be run on go1.20.2 |
| 54 | +go install golang.org/dl/go1.20.2@latest |
| 55 | +go1.20.2 download |
| 56 | +go1.20.2 test -v -proxy_addr=:$testProxyPort | tee -a $sponge_log |
| 57 | +RETURN_CODE=$? |
| 58 | + |
| 59 | +echo "exiting with ${RETURN_CODE}" |
| 60 | +exit ${RETURN_CODE} |
0 commit comments