Skip to content
Permalink
Browse files
feat: add from_service_account_info (#45)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/f529093e-7e5c-432b-bfc8-df2fd7eacf9c/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 350246057
Source-Link: googleapis/googleapis@5206824
  • Loading branch information
yoshi-automation committed Mar 23, 2021
1 parent 8359339 commit db77e88a44ffdabd284d61775960079309071617
Showing with 3,242 additions and 2,219 deletions.
  1. +15 −0 .github/header-checker-lint.yml
  2. +3 −1 .gitignore
  3. +20 −6 .kokoro/build.sh
  4. +11 −0 .kokoro/docs/docs-presubmit.cfg
  5. +11 −0 .kokoro/samples/python3.6/periodic-head.cfg
  6. +11 −0 .kokoro/samples/python3.7/periodic-head.cfg
  7. +11 −0 .kokoro/samples/python3.8/periodic-head.cfg
  8. +28 −0 .kokoro/test-samples-against-head.sh
  9. +102 −0 .kokoro/test-samples-impl.sh
  10. +16 −80 .kokoro/test-samples.sh
  11. +1 −1 .kokoro/trampoline_v2.sh
  12. +1 −1 .pre-commit-config.yaml
  13. +1 −0 .trampolinerc
  14. +18 −4 CONTRIBUTING.rst
  15. +2 −2 MANIFEST.in
  16. +6 −0 docs/servicedirectory_v1/lookup_service.rst
  17. +11 −0 docs/servicedirectory_v1/registration_service.rst
  18. +4 −6 docs/servicedirectory_v1/services.rst
  19. +1 −0 docs/servicedirectory_v1/types.rst
  20. +6 −0 docs/servicedirectory_v1beta1/lookup_service.rst
  21. +11 −0 docs/servicedirectory_v1beta1/registration_service.rst
  22. +4 −6 docs/servicedirectory_v1beta1/services.rst
  23. +1 −0 docs/servicedirectory_v1beta1/types.rst
  24. +33 −4 google/cloud/servicedirectory_v1/services/lookup_service/async_client.py
  25. +29 −17 google/cloud/servicedirectory_v1/services/lookup_service/client.py
  26. +9 −9 google/cloud/servicedirectory_v1/services/lookup_service/transports/base.py
  27. +48 −64 google/cloud/servicedirectory_v1/services/lookup_service/transports/grpc.py
  28. +52 −68 google/cloud/servicedirectory_v1/services/lookup_service/transports/grpc_asyncio.py
  29. +237 −210 google/cloud/servicedirectory_v1/services/registration_service/async_client.py
  30. +263 −244 google/cloud/servicedirectory_v1/services/registration_service/client.py
  31. +34 −25 google/cloud/servicedirectory_v1/services/registration_service/pagers.py
  32. +9 −9 google/cloud/servicedirectory_v1/services/registration_service/transports/base.py
  33. +48 −64 google/cloud/servicedirectory_v1/services/registration_service/transports/grpc.py
  34. +52 −68 google/cloud/servicedirectory_v1/services/registration_service/transports/grpc_asyncio.py
  35. +26 −26 google/cloud/servicedirectory_v1/types/__init__.py
  36. +1 −1 google/cloud/servicedirectory_v1/types/endpoint.py
  37. +1 −1 google/cloud/servicedirectory_v1/types/lookup_service.py
  38. +1 −1 google/cloud/servicedirectory_v1/types/namespace.py
  39. +12 −12 google/cloud/servicedirectory_v1/types/registration_service.py
  40. +2 −2 google/cloud/servicedirectory_v1/types/service.py
  41. +32 −3 google/cloud/servicedirectory_v1beta1/services/lookup_service/async_client.py
  42. +28 −16 google/cloud/servicedirectory_v1beta1/services/lookup_service/client.py
  43. +9 −9 google/cloud/servicedirectory_v1beta1/services/lookup_service/transports/base.py
  44. +48 −64 google/cloud/servicedirectory_v1beta1/services/lookup_service/transports/grpc.py
  45. +52 −68 google/cloud/servicedirectory_v1beta1/services/lookup_service/transports/grpc_asyncio.py
  46. +234 −207 google/cloud/servicedirectory_v1beta1/services/registration_service/async_client.py
  47. +260 −241 google/cloud/servicedirectory_v1beta1/services/registration_service/client.py
  48. +34 −25 google/cloud/servicedirectory_v1beta1/services/registration_service/pagers.py
  49. +9 −9 google/cloud/servicedirectory_v1beta1/services/registration_service/transports/base.py
  50. +48 −64 google/cloud/servicedirectory_v1beta1/services/registration_service/transports/grpc.py
  51. +52 −68 google/cloud/servicedirectory_v1beta1/services/registration_service/transports/grpc_asyncio.py
  52. +26 −26 google/cloud/servicedirectory_v1beta1/types/__init__.py
  53. +1 −1 google/cloud/servicedirectory_v1beta1/types/endpoint.py
  54. +1 −1 google/cloud/servicedirectory_v1beta1/types/lookup_service.py
  55. +1 −1 google/cloud/servicedirectory_v1beta1/types/namespace.py
  56. +12 −12 google/cloud/servicedirectory_v1beta1/types/registration_service.py
  57. +2 −2 google/cloud/servicedirectory_v1beta1/types/service.py
  58. +47 −10 noxfile.py
  59. +2 −1 renovate.json
  60. +6 −135 synth.metadata
  61. +15 −0 tests/unit/gapic/servicedirectory_v1/__init__.py
  62. +151 −81 tests/unit/gapic/servicedirectory_v1/test_lookup_service.py
  63. +427 −81 tests/unit/gapic/servicedirectory_v1/test_registration_service.py
  64. +15 −0 tests/unit/gapic/servicedirectory_v1beta1/__init__.py
  65. +151 −81 tests/unit/gapic/servicedirectory_v1beta1/test_lookup_service.py
  66. +427 −81 tests/unit/gapic/servicedirectory_v1beta1/test_registration_service.py
@@ -0,0 +1,15 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
@@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
@@ -15,7 +15,11 @@

set -eo pipefail

cd github/python-service-directory
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/python-service-directory"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
@@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

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

# If this is a continuous 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 = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
@@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-service-directory/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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-service-directory

exec .kokoro/test-samples-impl.sh
@@ -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"
@@ -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-service-directory

# 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 Build Cop Bot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
$KOKORO_GFILE_DIR/linux_amd64/buildcop
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
@@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
"KOKORO_GITHUB_COMMIT"
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
# For Build Cop Bot
# For FlakyBot
"KOKORO_GITHUB_COMMIT_URL"
"KOKORO_GITHUB_PULL_REQUEST_URL"
)
@@ -12,6 +12,6 @@ repos:
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
rev: 3.9.0
hooks:
- id: flake8
@@ -24,6 +24,7 @@ required_envvars+=(
pass_down_envvars+=(
"STAGING_BUCKET"
"V2_STAGING_BUCKET"
"NOX_SESSION"
)

# Prevent unintentional override on the default image.
Loading

0 comments on commit db77e88

Please sign in to comment.