diff --git a/handwritten/spanner/.kokoro/trampoline_v2.sh b/handwritten/spanner/.kokoro/trampoline_v2.sh index 2ed993bbdff3..46d7c10a51dc 100755 --- a/handwritten/spanner/.kokoro/trampoline_v2.sh +++ b/handwritten/spanner/.kokoro/trampoline_v2.sh @@ -254,9 +254,6 @@ else PROJECT_ROOT="$(repo_root $(pwd))/handwritten/spanner" fi -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - # Auto-injected conditional check # Check if the package directory has changes. If not, skip tests. if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then @@ -269,6 +266,7 @@ if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then # Safe default: HEAD~1..HEAD DIFF_RANGE="HEAD~1..HEAD" + git fetch --deepen=10 2>/dev/null || true if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." exit 0 @@ -277,6 +275,9 @@ if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then fi fi +log_yellow "Changing to the project root: ${PROJECT_ROOT}." +cd "${PROJECT_ROOT}" + # To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need # to use this environment variable in `PROJECT_ROOT`. if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then @@ -316,6 +317,7 @@ done # We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 # script: e.g. "github/repo-name/.kokoro/run_tests.sh" TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" +TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#handwritten/spanner/}" log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" # ignore error on docker operations and test execution diff --git a/handwritten/spanner/.trampolinerc b/handwritten/spanner/.trampolinerc index dea7e9541e63..5fc2253137db 100644 --- a/handwritten/spanner/.trampolinerc +++ b/handwritten/spanner/.trampolinerc @@ -49,4 +49,4 @@ if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then fi # Secret Manager secrets. -source ${PROJECT_ROOT}/handwritten/spanner/.kokoro/populate-secrets.sh +source ${PROJECT_ROOT}/.kokoro/populate-secrets.sh diff --git a/handwritten/spanner/system-test/spanner.ts b/handwritten/spanner/system-test/spanner.ts index 5ee4fcbd706b..56cc895018db 100644 --- a/handwritten/spanner/system-test/spanner.ts +++ b/handwritten/spanner/system-test/spanner.ts @@ -1193,7 +1193,11 @@ describe('Spanner', () => { assert.fail('Expected an error to be thrown, but it was not.'); } catch (err: any) { KOKORO_JOB_NAME?.includes('system-test-regular-session') - ? assert.strictEqual(err.code, grpc.status.FAILED_PRECONDITION) + ? assert.ok( + err.code === grpc.status.FAILED_PRECONDITION || + err.code === grpc.status.OUT_OF_RANGE, + `Expected FAILED_PRECONDITION (9) or OUT_OF_RANGE (11), got ${err.code}` + ) : assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); } };