Skip to content

Commit 2077158

Browse files
authored
test(bigtable): Run conformance tests for bigtable (#8658)
1 parent 3df0287 commit 2077158

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/conformance.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# Github action job to test core java library features on
15+
# downstream client libraries before they are released.
16+
on:
17+
push:
18+
paths:
19+
- 'bigtable/**'
20+
branches:
21+
- main
22+
pull_request:
23+
paths:
24+
- 'bigtable/**'
25+
name: bigtable_conformance
26+
jobs:
27+
bigtable_conformance:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
# Bigtable test proxy can be run on any of these Go versions
32+
go: [ '1.19', '1.20', '1.21' ]
33+
folders: ['bigtable']
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
path: google-cloud-go
38+
- uses: actions/checkout@v3
39+
with:
40+
repository: googleapis/cloud-bigtable-clients-test
41+
ref: main
42+
path: cloud-bigtable-clients-test
43+
- uses: actions/setup-go@v4
44+
with:
45+
go-version: ${{ matrix.go }}
46+
- run: go version
47+
- run: go install github.com/jstemmer/go-junit-report/v2@latest
48+
- run: chmod +x ./google-cloud-go/${{ matrix.folders }}/conformance_test.sh
49+
- run: ./google-cloud-go/${{ matrix.folders }}/conformance_test.sh

bigtable/conformance_test.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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

Comments
 (0)