-
Notifications
You must be signed in to change notification settings - Fork 2.6k
chore: migrate samples to google-cloud-python system test infrastructure #2768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
de548aa
fc7bc1d
f6826a0
d8fc4fe
2fb2dfd
afeda17
5eae651
dec658c
28c58a6
756928b
7923aab
3da048d
3aa338b
8f942dd
5466a51
b645e59
f3a86f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||
| # Copyright 2024 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 | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # https://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. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| set -eo pipefail | ||||||||||||||||||||||||||||||||
| shopt -s globstar | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Exit early if samples don't exist | ||||||||||||||||||||||||||||||||
| if ! find tests/system -name 'requirements.txt' | grep -q .; then | ||||||||||||||||||||||||||||||||
| echo "No tests run. './tests/system/**/requirements.txt' not found" | ||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During periodic builds, the repository is checked out at the To prevent this, we should dynamically fall back to
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Disable buffering, so that the logs stream through. | ||||||||||||||||||||||||||||||||
| export PYTHONUNBUFFERED=1 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Debug: show build environment | ||||||||||||||||||||||||||||||||
| env | grep KOKORO | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Install nox | ||||||||||||||||||||||||||||||||
| python3.9 -m pip install --upgrade --quiet nox virtualenv==20.26.6 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Setup project id. | ||||||||||||||||||||||||||||||||
| if [[ -f "${KOKORO_GFILE_DIR}/project-id.json" ]]; then | ||||||||||||||||||||||||||||||||
| export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") | ||||||||||||||||||||||||||||||||
| export GOOGLE_CLOUD_PROJECT="${PROJECT_ID}" | ||||||||||||||||||||||||||||||||
| gcloud config set project "$PROJECT_ID" | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Setup service account credentials. | ||||||||||||||||||||||||||||||||
| if [[ -f "${KOKORO_GFILE_DIR}/service-account.json" ]]; then | ||||||||||||||||||||||||||||||||
| export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/service-account.json" | ||||||||||||||||||||||||||||||||
| gcloud auth activate-service-account --key-file="${GOOGLE_APPLICATION_CREDENTIALS}" | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo -e "\n******************** TESTING PROJECTS ********************" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| set +e | ||||||||||||||||||||||||||||||||
| RTN=0 | ||||||||||||||||||||||||||||||||
| ROOT=$(pwd) | ||||||||||||||||||||||||||||||||
| for file in tests/system/**/requirements.txt; do | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||
| cd "$ROOT" | ||||||||||||||||||||||||||||||||
| file=$(dirname "$file") | ||||||||||||||||||||||||||||||||
| cd "$file" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "------------------------------------------------------------" | ||||||||||||||||||||||||||||||||
| echo "- testing $file" | ||||||||||||||||||||||||||||||||
| echo "------------------------------------------------------------" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| python3.9 -m nox -s "$RUN_TESTS_SESSION" | ||||||||||||||||||||||||||||||||
| EXIT=$? | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then | ||||||||||||||||||||||||||||||||
| chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot | ||||||||||||||||||||||||||||||||
| $KOKORO_GFILE_DIR/linux_amd64/flakybot | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if [[ $EXIT -ne 0 ]]; then | ||||||||||||||||||||||||||||||||
| RTN=1 | ||||||||||||||||||||||||||||||||
| echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| echo -e "\n Testing completed.\n" | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| cd "$ROOT" | ||||||||||||||||||||||||||||||||
| exit "$RTN" | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
.kokoro/test-samples-against-head.shhas been renamed to.kokoro/test-system-against-head.sh, please make sure to update theTRAMPOLINE_BUILD_FILEenvironment variable in allperiodic-head.cfgfiles (e.g.,.kokoro/system/python3.10/periodic-head.cfg, etc.) to point to the new filename. Currently, they still reference the old.kokoro/test-samples-against-head.shpath, which will cause those builds to fail.