Skip to content
1 change: 1 addition & 0 deletions bigtable/conformance_known_failures.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TestMutateRow_Generic_Headers\|TestReadRows_Generic_Headers\|TestReadRow_Generic_Headers\|TestReadModifyWriteRow_Generic_Headers\|TestMutateRows_Generic_Headers\|TestCheckAndMutateRow_Generic_Headers\|TestSampleRowKeys_Generic_Headers\|TestCheckAndMutateRow_NoRetry_TrueMutations\|TestCheckAndMutateRow_NoRetry_TransientError\|TestCheckAndMutateRow_Generic_CloseClient\|TestCheckAndMutateRow_Generic_DeadlineExceeded\|TestMutateRow_Generic_CloseClient\|TestMutateRow_Generic_DeadlineExceeded\|TestMutateRows_NoRetry_NonTransientErrors\|TestMutateRows_Generic_DeadlineExceeded\|TestMutateRows_Retry_TransientErrors\|TestMutateRows_Retry_ExponentialBackoff\|TestMutateRows_Generic_CloseClient\|TestReadModifyWriteRow_NoRetry_TransientError\|TestReadModifyWriteRow_Generic_CloseClient\|TestReadModifyWriteRow_Generic_DeadlineExceeded\|TestReadRow_Generic_DeadlineExceeded\|TestReadRow_Generic_CloseClient\|TestReadRows_NoRetry_OutOfOrderError\|TestReadRows_NoRetry_ErrorAfterLastRow\|TestReadRows_Retry_PausedScan\|TestReadRows_Retry_LastScannedRow\|TestReadRows_Retry_StreamReset\|TestReadRows_Generic_CloseClient\|TestReadRows_Generic_DeadlineExceeded\|TestSampleRowKeys_Generic_CloseClient\|TestSampleRowKeys_Generic_DeadlineExceeded
85 changes: 85 additions & 0 deletions bigtable/conformance_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/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.

# Fail on any error
set -eo pipefail

# Display commands being run
set -x

# Only run on Go 1.20.2+
min_minor_ver=20
min_patch_ver=2

v=`go version | { read _ _ v _; echo ${v#go}; }`
comps=(${v//./ })
minor_ver=${comps[1]}
patch_ver=${comps[2]}

if [ "$minor_ver" -lt $min_minor_ver ]; then
echo minor version $minor_ver, skipping
exit 0
fi
if [ "$patch_ver" -lt $min_patch_ver ]; then
echo patch version $patch_ver, skipping
exit 0
fi

export BIGTABLE_CLIENT_LIB_HOME=$GOCLOUD_HOME/bigtable
export BIGTABLE_TEST_PROXY_PORT=9999
export BIGTABLE_TEST_PROXY_HOME=$BIGTABLE_CLIENT_LIB_HOME/internal/testproxy
export BIGTABLE_CONFORMANCE_TESTS_HOME=$KOKORO_ARTIFACTS_DIR/cloud-bigtable-clients-test/

sponge_log=$BIGTABLE_CLIENT_LIB_HOME/sponge_log.log

pushd $BIGTABLE_TEST_PROXY_HOME > /dev/null;
go build
popd > /dev/null;

nohup $BIGTABLE_TEST_PROXY_HOME/testproxy --port $BIGTABLE_TEST_PROXY_PORT &
proxyPID=$!

# Stop the testproxy & cleanup environment variables
function cleanup() {
echo "Cleanup testproxy"
rm -rf $BIGTABLE_CONFORMANCE_TESTS_HOME
kill -9 $proxyPID
unset BIGTABLE_CLIENT_LIB_HOME;
unset BIGTABLE_TEST_PROXY_PORT;
unset BIGTABLE_TEST_PROXY_HOME;
unset BIGTABLE_CONFORMANCE_TESTS_HOME;
}
trap cleanup EXIT

# Checkout Bigtable conformance tests
mkdir -p $BIGTABLE_CONFORMANCE_TESTS_HOME
git clone https://github.com/googleapis/cloud-bigtable-clients-test.git $BIGTABLE_CONFORMANCE_TESTS_HOME
Comment thread
bhshkh marked this conversation as resolved.
Outdated

pushd $BIGTABLE_CONFORMANCE_TESTS_HOME/tests > /dev/null;
# Run the conformance tests
echo "Running Bigtable conformance tests" | tee -a $sponge_log
(go test -v -proxy_addr=:$BIGTABLE_TEST_PROXY_PORT | tee -a $sponge_log) \
|| (echo "Ignoring errors from tests run without skipping known failures" | tee -a $sponge_log)

# Run the conformance tests skipping known failures
echo "Running Bigtable conformance tests skipping known failures" | tee -a $sponge_log
known_failures=$(cat $BIGTABLE_CLIENT_LIB_HOME/conformance_known_failures.txt)
eval "go test -v -proxy_addr=:$BIGTABLE_TEST_PROXY_PORT -skip $known_failures | tee -a $sponge_log"
RETURN_CODE=$?
popd > /dev/null;

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}
Comment thread
bhshkh marked this conversation as resolved.
Outdated
17 changes: 17 additions & 0 deletions internal/kokoro/continuous.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ runEmulatorTests() {
fi
}


# runConformanceTests runs conformance tests in the current directory.
runConformanceTests() {
if [ -f "conformance_test.sh" ]; then
./conformance_test.sh
# Takes the kokoro output log (raw stdout) and creates a machine-parseable
# xUnit XML file.
cat sponge_log.log |
go-junit-report -set-exit-code >sponge_log.xml
# Add the exit codes together so we exit non-zero if any module fails.
exit_code=$(($exit_code + $?))
fi
}

# testAllModules runs all modules' tests, including emulator tests.
testAllModules() {
echo "Testing all modules"
Expand All @@ -117,6 +131,8 @@ testAllModules() {
runDirectoryTests
# Run integration tests against an emulator.
runEmulatorTests
# Run conformance tests against test proxy
runConformanceTests
popd > /dev/null;
done
}
Expand All @@ -129,6 +145,7 @@ testChangedModules() {
for gd in $goDirectories; do
pushd "$gd" > /dev/null;
runDirectoryTests .
runConformanceTests
popd > /dev/null;
done
fi
Expand Down
6 changes: 6 additions & 0 deletions internal/kokoro/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ runPresubmitTests() {
if [ -f "emulator_test.sh" ]; then
./emulator_test.sh
fi

# Run conformance tests against a test proxy.
if [ -f "conformance_test.sh" ]; then
./conformance_test.sh
fi
Comment thread
bhshkh marked this conversation as resolved.
Outdated

# Takes the kokoro output log (raw stdout) and creates a machine-parseable
# xUnit XML file.
cat sponge_log.log |
Expand Down