Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: googleapis/python-network-connectivity
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.0
Choose a base ref
...
head repository: googleapis/python-network-connectivity
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.0
Choose a head ref

Commits on Mar 23, 2021

  1. feat: add from_service_account_info (#12)

    This PR was generated using Autosynth. 🌈
    
    Synth log will be available here:
    https://source.cloud.google.com/results/invocations/fb22f59c-8962-43c6-89b6-9796466cdaca/targets
    
    - [ ] To automatically regenerate this PR, check this box.
    
    PiperOrigin-RevId: 359562873
    Source-Link: googleapis/googleapis@07932bb
    yoshi-automation authored Mar 23, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f1f7ccb View commit details
  2. test: install pyopenssl for mtls testing (#13)

    This PR was generated using Autosynth. 🌈
    
    Synth log will be available here:
    https://source.cloud.google.com/results/invocations/f169e545-1f46-4498-92b8-ef79af1ecedc/targets
    
    - [ ] To automatically regenerate this PR, check this box.
    
    Source-Link: googleapis/synthtool@0780323
    yoshi-automation authored Mar 23, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4d0f228 View commit details

Commits on Mar 30, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    993d25f View commit details

Commits on Mar 31, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    46f0f37 View commit details

Commits on Apr 1, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ab588c6 View commit details

Commits on Apr 7, 2021

  1. chore: Add license headers for python config files (#21)

    This PR was generated using Autosynth. 🌈
    
    Synth log will be available here:
    https://source.cloud.google.com/results/invocations/d9d975fd-7d94-4e18-acf5-f81484b3e675/targets
    
    - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)
    
    Source-Link: googleapis/synthtool@5b5bf6d
    yoshi-automation authored Apr 7, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e40fe58 View commit details

Commits on Apr 11, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    85fb072 View commit details

Commits on Apr 16, 2021

  1. chore: prevent normalization of semver versioning (#24)

    * chore: prevent normalization of semver versioning
    
    * chore: update workaround to make sic work
    dandhlee authored Apr 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    acc537d View commit details
  2. chore: update templates (#23)

    This PR was generated using Autosynth. 🌈
    
    Synth log will be available here:
    https://source.cloud.google.com/results/invocations/443b1bca-6b8d-4040-97fb-39f69f52002f/targets
    
    - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)
    
    Source-Link: googleapis/synthtool@043cc62
    Source-Link: googleapis/synthtool@721339a
    yoshi-automation authored Apr 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    de9128e View commit details

Commits on Apr 26, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a9d8032 View commit details
  2. chore(revert): revert preventing normalization (#25)

    reverts previous commit for preventing normalization of versioning
    dandhlee authored Apr 26, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a2b53f2 View commit details

Commits on May 12, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    07200ca View commit details

Commits on May 14, 2021

  1. chore: upgrade gapic-generator-python to 0.46.3 (#36)

    PiperOrigin-RevId: 373649163
    
    Source-Link: googleapis/googleapis@7e1b14e
    
    Source-Link: https://github.com/googleapis/googleapis-gen/commit/0a3c7d272d697796db75857bac73905c68e498c3
    
    fix: add async client to %name_%version/init.py
    chore: add autogenerated snippets
    chore: remove auth, policy, and options from the reserved names list
    feat: support self-signed JWT flow for service accounts
    chore: enable GAPIC metadata generation
    chore: sort subpackages in %namespace/%name/init.py
    gcf-owl-bot[bot] authored May 14, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    013202c View commit details
  2. chore: add SECURITY.md (#27)

    chore: add SECURITY.md
    google-cloud-policy-bot[bot] authored May 14, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ff5b7fe View commit details

Commits on May 15, 2021

  1. fix(deps): add packaging requirement (#37)

    Add packaging requirement. packaging.version
                  is used for a version comparison in transports/base.py and is needed after the upgrade to gapic-generator-python 0.46.3
    busunkim96 authored May 15, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3592699 View commit details

Commits on May 16, 2021

  1. chore: new owl bot post processor docker image (#38)

    gcr.io/repo-automation-bots/owlbot-python:latest@sha256:4c981a6b6f2b8914a448d7b3a01688365be03e3ed26dfee399a6aa77fb112eaa
    gcf-owl-bot[bot] authored May 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d85ecfc View commit details

Commits on May 22, 2021

  1. chore: new owl bot post processor docker image (#39)

    gcr.io/repo-automation-bots/owlbot-python:latest@sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479
    gcf-owl-bot[bot] authored May 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5549a92 View commit details

Commits on May 28, 2021

  1. chore: new owl bot post processor docker image (#40)

    gcr.io/repo-automation-bots/owlbot-python:latest@sha256:0856ca711da1fd5ec9d6d7da6c50aa0bbf550fb94acb47b55159a640791987bf
    gcf-owl-bot[bot] authored May 28, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ee91ee4 View commit details
  2. chore: new owl bot post processor docker image (#41)

    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600
    gcf-owl-bot[bot] authored May 28, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8fb0c59 View commit details

Commits on Jun 16, 2021

  1. fix: exclude docs and tests from package (#42)

    Only include packages that start with google in the published artifact
    busunkim96 authored Jun 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ee876c9 View commit details
  2. chore: release 0.3.0 (#16)

    🤖 I have created a release \*beep\* \*boop\*
    ---
    ## [0.3.0](https://www.github.com/googleapis/python-network-connectivity/compare/v0.2.0...v0.3.0) (2021-06-16)
    
    
    ### Features
    
    * add `from_service_account_info` ([#12](https://www.github.com/googleapis/python-network-connectivity/issues/12)) ([f1f7ccb](https://www.github.com/googleapis/python-network-connectivity/commit/f1f7ccb4dde88718462361db2f0ff72ff8fbbf0d))
    * support self-signed JWT flow for service accounts ([013202c](https://www.github.com/googleapis/python-network-connectivity/commit/013202c7af491384b01f7f8a070d755ea277e4ae))
    
    
    ### Bug Fixes
    
    * add async client to %name_%version/init.py ([013202c](https://www.github.com/googleapis/python-network-connectivity/commit/013202c7af491384b01f7f8a070d755ea277e4ae))
    * **deps:** add packaging requirement ([#37](https://www.github.com/googleapis/python-network-connectivity/issues/37)) ([3592699](https://www.github.com/googleapis/python-network-connectivity/commit/359269920e4d11e00af6c7830161b2220b476b55))
    * exclude docs and tests from package ([#42](https://www.github.com/googleapis/python-network-connectivity/issues/42)) ([ee876c9](https://www.github.com/googleapis/python-network-connectivity/commit/ee876c91794a5b5f23dd2ce2bd9434f62c18a33d))
    ---
    
    
    This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
    release-please[bot] authored Jun 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e22f8c2 View commit details
Showing with 1,486 additions and 1,104 deletions.
  1. +3 −0 .github/.OwlBot.lock.yaml
  2. +26 −0 .github/.OwlBot.yaml
  3. +1 −1 .github/header-checker-lint.yml
  4. +2 −2 .kokoro/release.sh
  5. +2 −12 .kokoro/release/common.cfg
  6. +11 −0 .kokoro/samples/python3.6/periodic-head.cfg
  7. +11 −0 .kokoro/samples/python3.7/periodic-head.cfg
  8. +11 −0 .kokoro/samples/python3.8/periodic-head.cfg
  9. +28 −0 .kokoro/test-samples-against-head.sh
  10. +102 −0 .kokoro/test-samples-impl.sh
  11. +16 −80 .kokoro/test-samples.sh
  12. +15 −1 .pre-commit-config.yaml
  13. +1 −0 .repo-metadata.json
  14. +15 −0 CHANGELOG.md
  15. +1 −15 CONTRIBUTING.rst
  16. +7 −0 SECURITY.md
  17. +12 −1 docs/_static/custom.css
  18. +14 −0 docs/conf.py
  19. +2 −2 docs/multiprocessing.rst
  20. +0 −1 docs/networkconnectivity_v1alpha1/hub_service.rst
  21. +9 −9 google/cloud/networkconnectivity/__init__.py
  22. +5 −4 google/cloud/networkconnectivity_v1alpha1/__init__.py
  23. +123 −0 google/cloud/networkconnectivity_v1alpha1/gapic_metadata.json
  24. +0 −1 google/cloud/networkconnectivity_v1alpha1/services/__init__.py
  25. +0 −2 google/cloud/networkconnectivity_v1alpha1/services/hub_service/__init__.py
  26. +43 −43 google/cloud/networkconnectivity_v1alpha1/services/hub_service/async_client.py
  27. +47 −74 google/cloud/networkconnectivity_v1alpha1/services/hub_service/client.py
  28. +2 −4 google/cloud/networkconnectivity_v1alpha1/services/hub_service/pagers.py
  29. +0 −2 google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/__init__.py
  30. +104 −48 google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/base.py
  31. +72 −89 google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/grpc.py
  32. +66 −94 google/cloud/networkconnectivity_v1alpha1/services/hub_service/transports/grpc_asyncio.py
  33. +18 −20 google/cloud/networkconnectivity_v1alpha1/types/__init__.py
  34. +8 −18 google/cloud/networkconnectivity_v1alpha1/types/common.py
  35. +55 −97 google/cloud/networkconnectivity_v1alpha1/types/hub.py
  36. +27 −25 noxfile.py
  37. +6 −13 synth.py → owlbot.py
  38. +5 −1 renovate.json
  39. +11 −14 scripts/fixup_networkconnectivity_v1alpha1_keywords.py
  40. +7 −2 setup.py
  41. +0 −135 synth.metadata
  42. 0 testing/constraints-3.10.txt
  43. 0 testing/constraints-3.11.txt
  44. +24 −0 testing/constraints-3.6.txt
  45. 0 testing/constraints-3.7.txt
  46. 0 testing/constraints-3.8.txt
  47. 0 testing/constraints-3.9.txt
  48. +15 −0 tests/__init__.py
  49. +15 −0 tests/unit/__init__.py
  50. +15 −0 tests/unit/gapic/__init__.py
  51. +15 −1 tests/unit/gapic/networkconnectivity_v1alpha1/__init__.py
  52. +514 −293 tests/unit/gapic/networkconnectivity_v1alpha1/test_hub_service.py
3 changes: 3 additions & 0 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
digest: sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600
26 changes: 26 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 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.

docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest

deep-remove-regex:
- /owl-bot-staging

deep-copy-regex:
- source: /google/cloud/networkconnectivity/(v.*)/.*-py/(.*)
dest: /owl-bot-staging/$1/$2

begin-after-commit-hash: b06c9034cfcbce180ba732d03be6526e5c8ea1bc

2 changes: 1 addition & 1 deletion .github/header-checker-lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
4 changes: 2 additions & 2 deletions .kokoro/release.sh
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools
export PYTHONUNBUFFERED=1

# Move into the package, build the distribution and upload.
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token")
cd github/python-network-connectivity
python3 setup.py sdist bdist_wheel
twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*
14 changes: 2 additions & 12 deletions .kokoro/release/common.cfg
Original file line number Diff line number Diff line change
@@ -23,18 +23,8 @@ env_vars: {
value: "github/python-network-connectivity/.kokoro/release.sh"
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Tokens needed to report release status back to GitHub
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
}
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token"
}
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.6/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.7/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.8/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
28 changes: 28 additions & 0 deletions .kokoro/test-samples-against-head.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2020 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.

# A customized test runner for samples.
#
# For periodic builds, you can specify this file for testing against head.

# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

cd github/python-network-connectivity

exec .kokoro/test-samples-impl.sh
102 changes: 102 additions & 0 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash
# Copyright 2021 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.


# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
exit 0
fi

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Debug: show build environment
env | grep KOKORO

# Install nox
python3.6 -m pip install --upgrade --quiet nox

# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
gcloud auth activate-service-account \
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
--project="cloud-devrel-kokoro-resources"
fi

# This script will create 3 files:
# - testing/test-env.sh
# - testing/service-account.json
# - testing/client-secrets.json
./scripts/decrypt-secrets.sh

source ./testing/test-env.sh
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json

# For cloud-run session, we activate the service account for gcloud sdk.
gcloud auth activate-service-account \
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"

export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json

echo -e "\n******************** TESTING PROJECTS ********************"

# Switch to 'fail at end' to allow all tests to complete before exiting.
set +e
# Use RTN to return a non-zero value if the test fails.
RTN=0
ROOT=$(pwd)
# Find all requirements.txt in the samples directory (may break on whitespace).
for file in samples/**/requirements.txt; do
cd "$ROOT"
# Navigate to the project folder.
file=$(dirname "$file")
cd "$file"

echo "------------------------------------------------------------"
echo "- testing $file"
echo "------------------------------------------------------------"

# Use nox to execute the tests for the project.
python3.6 -m nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
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"

# Workaround for Kokoro permissions issue: delete secrets
rm testing/{test-env.sh,client-secrets.json,service-account.json}

exit "$RTN"
96 changes: 16 additions & 80 deletions .kokoro/test-samples.sh
Original file line number Diff line number Diff line change
@@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# The default test runner for samples.
#
# For periodic builds, we rewinds the repo to the latest release, and
# run test-samples-impl.sh.

# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
@@ -24,87 +28,19 @@ cd github/python-network-connectivity

# Run periodic samples tests at latest release
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
# preserving the test runner implementation.
cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh"
echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
echo "Now we rewind the repo back to the latest release..."
LATEST_RELEASE=$(git describe --abbrev=0 --tags)
git checkout $LATEST_RELEASE
fi

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
exit 0
fi

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Debug: show build environment
env | grep KOKORO

# Install nox
python3.6 -m pip install --upgrade --quiet nox

# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
gcloud auth activate-service-account \
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
--project="cloud-devrel-kokoro-resources"
fi

# This script will create 3 files:
# - testing/test-env.sh
# - testing/service-account.json
# - testing/client-secrets.json
./scripts/decrypt-secrets.sh

source ./testing/test-env.sh
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json

# For cloud-run session, we activate the service account for gcloud sdk.
gcloud auth activate-service-account \
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"

export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json

echo -e "\n******************** TESTING PROJECTS ********************"

# Switch to 'fail at end' to allow all tests to complete before exiting.
set +e
# Use RTN to return a non-zero value if the test fails.
RTN=0
ROOT=$(pwd)
# Find all requirements.txt in the samples directory (may break on whitespace).
for file in samples/**/requirements.txt; do
cd "$ROOT"
# Navigate to the project folder.
file=$(dirname "$file")
cd "$file"

echo "------------------------------------------------------------"
echo "- testing $file"
echo "------------------------------------------------------------"

# Use nox to execute the tests for the project.
python3.6 -m nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
echo "The current head is: "
echo $(git rev-parse --verify HEAD)
echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
# move back the test runner implementation if there's no file.
if [ ! -f .kokoro/test-samples-impl.sh ]; then
cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh
fi
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"

# Workaround for Kokoro permissions issue: delete secrets
rm testing/{test-env.sh,client-secrets.json,service-account.json}

exit "$RTN"
exec .kokoro/test-samples-impl.sh
16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2021 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.
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
@@ -12,6 +26,6 @@ repos:
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
rev: 3.9.2
hooks:
- id: flake8
1 change: 1 addition & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
"issue_tracker": "",
"release_level": "alpha",
"language": "python",
"library_type": "GAPIC_AUTO",
"repo": "googleapis/python-network-connectivity",
"distribution_name": "google-cloud-network-connectivity",
"api_id": "networkconnectivity.googleapis.com"
Loading