Skip to content

Commit

Permalink
Also run check_go_generated_files_up_to_date.sh in tink-go-gcpkms Baz…
Browse files Browse the repository at this point in the history
…el test

PiperOrigin-RevId: 573727058
Change-Id: I96cd6176c0f62467444ade7700d9813006b106cf
  • Loading branch information
morambro authored and copybara-github committed Oct 16, 2023
1 parent b92804b commit 2cbaf5f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
6 changes: 1 addition & 5 deletions integration/gcpkms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ go_library(
go_test(
name = "gcpkms_test",
srcs = [
"gcp_kms_integration_test.go",
"gcp_kms_client_test.go",
"gcp_kms_integration_test.go",
],
data = [
# Credentials can be injected into the test files included in these
Expand All @@ -38,10 +38,6 @@ go_test(
deps = [
":gcpkms",
"@com_github_tink_crypto_tink_go_v2//aead",
"@com_github_tink_crypto_tink_go_v2//core/registry",
"@com_github_tink_crypto_tink_go_v2//keyset",
"@com_github_tink_crypto_tink_go_v2//subtle/random",
"@com_github_tink_crypto_tink_go_v2//tink",
"@org_golang_google_api//option",
],
)
Expand Down
30 changes: 25 additions & 5 deletions kokoro/gcp_ubuntu/bazel/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,37 @@ if [[ -n "${CONTAINER_IMAGE:-}" ]]; then
RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" )
fi

# TODO(b/238389921): Run check_go_generated_files_up_to_date.sh after a
# refactoring that takes into account extensions to tink-go.
./kokoro/testutils/copy_credentials.sh "testdata" "gcp"

cat <<'EOF' > _do_run_test.sh
#!/bin/bash
set -euo pipefail
./kokoro/testutils/check_go_generated_files_up_to_date.sh "$(pwd)"
MANUAL_TARGETS=()
# Run manual tests that rely on test data only available via Bazel.
if [[ -n "${KOKORO_ROOT:-}" ]]; then
MANUAL_TARGETS+=( "//integration/gcpkms:gcpkms_test" )
fi
readonly MANUAL_TARGETS
./kokoro/testutils/run_bazel_tests.sh \
-t --test_arg=--test.v . "${MANUAL_TARGETS[@]}"
EOF
chmod +x _do_run_test.sh

cat <<EOF > _env_variables.txt
KOKORO_ROOT
EOF
RUN_COMMAND_ARGS+=( -e _env_variables.txt )

# Run cleanup on EXIT.
trap cleanup EXIT

cleanup() {
rm -rf _do_run_test.sh
rm -rf _env_variables.txt
}

./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \
./kokoro/testutils/run_bazel_tests.sh \
-t --test_arg=--test.v . "${MANUAL_TARGETS[@]}"
./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" ./_do_run_test.sh

0 comments on commit 2cbaf5f

Please sign in to comment.