|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Copyright 2021 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -eu |
| 17 | + |
| 18 | +source "$(dirname "$0")/../../../../ci/lib/init.sh" |
| 19 | +source module /ci/etc/integration-tests-config.sh |
| 20 | +source module /ci/lib/io.sh |
| 21 | +source module /google/cloud/spanner/ci/lib/spanner_emulator.sh |
| 22 | + |
| 23 | +if [[ $# -lt 2 ]]; then |
| 24 | + echo "Usage: $(basename "$0") <bazel-program> <bazel-verb> [bazel-test-args]" |
| 25 | + exit 1 |
| 26 | +fi |
| 27 | + |
| 28 | +BAZEL_BIN="$1" |
| 29 | +shift |
| 30 | +BAZEL_VERB="$1" |
| 31 | +shift |
| 32 | +bazel_test_args=("$@") |
| 33 | + |
| 34 | +# Start the emulator and arranges to kill it, run in $HOME because |
| 35 | +# pubsub_emulator::start creates unsightly *.log files in the workspace |
| 36 | +# otherwise. Use a fixed port so Bazel can cache the test results. |
| 37 | +pushd "${HOME}" >/dev/null |
| 38 | +spanner_emulator::start 8787 |
| 39 | +popd |
| 40 | +trap spanner_emulator::kill EXIT |
| 41 | + |
| 42 | +"${BAZEL_BIN}" "${BAZEL_VERB}" "${bazel_test_args[@]}" \ |
| 43 | + --test_env="SPANNER_EMULATOR_HOST=${SPANNER_EMULATOR_HOST}" \ |
| 44 | + --test_env="GOOGLE_CLOUD_CPP_AUTO_RUN_EXAMPLES=yes" \ |
| 45 | + --test_env="GOOGLE_CLOUD_CPP_EXPERIMENTAL_LOG_CONFIG=lastN,100,WARNING" \ |
| 46 | + --test_env="GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc,rpc-streams" \ |
| 47 | + --test_env="GOOGLE_CLOUD_CPP_TRACING_OPTIONS=truncate_string_field_longer_than=512" \ |
| 48 | + --test_env="GOOGLE_CLOUD_CPP_SPANNER_SLOW_INTEGRATION_TESTS=instance,backup" \ |
| 49 | + --test_tag_filters="integration-test" -- \ |
| 50 | + "//google/cloud/spanner/...:all" |
0 commit comments