Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

test: re-enable system tests on byoid #671

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

Merged
merged 36 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
41599ae
refactor: split 'with_quota_project' into separate base class (#561)
busunkim96 Sep 2, 2020
d32f7df
fix: dummy commit to trigger a auto release (#597)
arithmetic1728 Sep 3, 2020
892dc37
chore: release 1.21.1 (#599)
release-please[bot] Sep 3, 2020
694d83f
fix: migrate signBlob to iamcredentials.googleapis.com (#600)
busunkim96 Sep 8, 2020
b921a0a
chore: release 1.21.2 (#601)
release-please[bot] Sep 16, 2020
d0e0aba
fix: fix expiry for `to_json()` (#589)
wescpy Sep 17, 2020
da3526f
chore: add default CODEOWNERS (#609)
busunkim96 Sep 22, 2020
cc91e75
chore: release 1.21.3 (#607)
release-please[bot] Sep 23, 2020
7e15258
feat: add asyncio based auth flow (#612)
crwilcox Sep 28, 2020
ee5617c
chore: release 1.22.0 (#615)
release-please[bot] Sep 28, 2020
a924011
fix: move aiohttp to extra as it is currently internal surface (#619)
crwilcox Oct 5, 2020
7f957ba
chore: release 1.22.1 (#620)
release-please[bot] Oct 5, 2020
6407258
fix: remove checks for ancient versions of Cryptography (#596)
akx Oct 8, 2020
3b3172e
tests: fix unit tests on python 3.6 / 3.7 (#630)
tseaver Oct 22, 2020
5906c85
Change metadata service helper to work with any query parameters (#588)
davidwtbuxton Oct 23, 2020
05f9524
fix: pin 'aoihttp < 3.7.0dev' (#634)
tseaver Oct 27, 2020
755e702
chore: add infrastructure to support `docs-presubmit` build (via synt…
yoshi-automation Oct 28, 2020
9c4200d
Update example in oauth2.id_token docs (#624)
matthewhughes934 Oct 28, 2020
d0a47c1
build: use pypi secret from secret manager (#639)
yoshi-automation Oct 29, 2020
0323cf3
feat: Add custom scopes for access tokens from the metadata service (…
davidwtbuxton Oct 29, 2020
b790e65
fix(deps): Revert "fix: pin 'aoihttp < 3.7.0dev' (#634)" (#632) (#640)
davidwtbuxton Oct 29, 2020
bc92abb
chore: release 1.23.0 (#641)
release-please[bot] Oct 29, 2020
3319ea8
docs: fix typo in import (#651)
busunkim96 Dec 7, 2020
2d3b8d1
chore: fix comment about clock_skew (#653)
busunkim96 Dec 8, 2020
6de753d
feat: add Python 3.9 support, drop Python 3.5 support (#655)
tseaver Dec 11, 2020
da922f0
chore: add constraints file (#649)
busunkim96 Dec 11, 2020
ec1b688
chore: fix typo (#647)
dgorelik Dec 11, 2020
fd9b5b1
fix: avoid losing the original '_include_email' parameter in imperson…
pietrodn Dec 11, 2020
647290a
chore: release 1.24.0 (#656)
release-please[bot] Dec 11, 2020
f062da8
chore(python): skip docfx in main presubmit (#661)
yoshi-automation Jan 11, 2021
694e558
chore: add missing quotation mark (#664)
yoshi-automation Jan 12, 2021
621f54b
test: re-enable system tests (#670)
busunkim96 Jan 22, 2021
bd59f6e
Merge branch 'master' into byoid-update
busunkim96 Jan 22, 2021
d75f57a
test: add secrest
busunkim96 Jan 22, 2021
589ed81
build: fix build.sh
busunkim96 Jan 22, 2021
a542a9b
test: add __init__.py so import succeeds
busunkim96 Jan 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ scripts/local_test_setup
tests/data/key.json
tests/data/key.p12
tests/data/user-key.json
system_tests/data/

# PyCharm configuration:
.idea
Expand Down
32 changes: 25 additions & 7 deletions 32 .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

set -eo pipefail

cd github/google-auth-library-python
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/google-auth-library-python"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
Expand All @@ -27,19 +31,33 @@ env | grep KOKORO
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json

# Setup project id.
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.txt")

# Activate gcloud with service account credentials
gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
gcloud config set project ${PROJECT_ID}

# Decrypt system test secrets
./scripts/decrypt-secrets.sh

# 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 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


# Decrypt system test secrets
./scripts/decrypt-secrets.sh

# Run system tests which use a different noxfile
python3 -m nox -f system_tests/noxfile.py
2 changes: 1 addition & 1 deletion 2 .kokoro/continuous/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ action {
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-auth-library-python"

# Use the trampoline script to run in docker.
build_file: "google-auth-library-python/.kokoro/trampoline.sh"
Expand Down
11 changes: 11 additions & 0 deletions 11 .kokoro/docs/docs-presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-auth-library-python/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
2 changes: 1 addition & 1 deletion 2 .kokoro/presubmit/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ action {
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-python"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-auth-library-python"

# Use the trampoline script to run in docker.
build_file: "google-auth-library-python/.kokoro/trampoline.sh"
Expand Down
4 changes: 2 additions & 2 deletions 4 synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/google-auth-library-python.git",
"sha": "9c4200dff31986b7ff300126e9aa35d14aa84dba"
"sha": "f062da8392c32fb3306cdc6e4dbae78212aa0dc7"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "da5c6050d13b4950c82666a81d8acd25157664ae"
"sha": "16ec872dd898d7de6e1822badfac32484b5d9031"
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions 6 synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
s.move(
templated_files / ".kokoro",
excludes=[
".kokoro/continuous/common.cfg",
".kokoro/presubmit/common.cfg",
".kokoro/build.sh",
"continuous/common.cfg",
"presubmit/common.cfg",
"build.sh",
],
) # just move kokoro configs
Empty file added 0 system_tests/__init__.py
Empty file.
10 changes: 5 additions & 5 deletions 10 system_tests/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import py.path

HERE = os.path.abspath(os.path.dirname(__file__))
LIBRARY_DIR = os.path.join(HERE, "..")
LIBRARY_DIR = os.path.abspath(os.path.dirname(HERE))
DATA_DIR = os.path.join(HERE, "data")
SERVICE_ACCOUNT_FILE = os.path.join(DATA_DIR, "service_account.json")
AUTHORIZED_USER_FILE = os.path.join(DATA_DIR, "authorized_user.json")
Expand Down Expand Up @@ -169,7 +169,7 @@ def configure_cloud_sdk(session, application_default_credentials, project=False)
# Test sesssions

TEST_DEPENDENCIES_ASYNC = ["aiohttp", "pytest-asyncio", "nest-asyncio"]
TEST_DEPENDENCIES_SYNC = ["pytest", "requests"]
TEST_DEPENDENCIES_SYNC = ["pytest", "requests", "mock"]
PYTHON_VERSIONS_ASYNC = ["3.7"]
PYTHON_VERSIONS_SYNC = ["2.7", "3.7"]

Expand Down Expand Up @@ -249,6 +249,7 @@ def app_engine(session):
session.log("Skipping App Engine tests.")
return

session.install(LIBRARY_DIR)
# Unlike the default tests above, the App Engine system test require a
# 'real' gcloud sdk installation that is configured to deploy to an
# app engine project.
Expand All @@ -269,9 +270,8 @@ def app_engine(session):
application_url = GAE_APP_URL_TMPL.format(GAE_TEST_APP_SERVICE, project_id)

# Vendor in the test application's dependencies
session.chdir(os.path.join(HERE, "../app_engine_test_app"))
session.chdir(os.path.join(HERE, "system_tests_sync/app_engine_test_app"))
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run(
"pip", "install", "--target", "lib", "-r", "requirements.txt", silent=True
)
Expand All @@ -288,7 +288,7 @@ def app_engine(session):
@nox.session(python=PYTHON_VERSIONS_SYNC)
def grpc(session):
session.install(LIBRARY_DIR)
session.install(*TEST_DEPENDENCIES_SYNC, "google-cloud-pubsub==1.0.0")
session.install(*TEST_DEPENDENCIES_SYNC, "google-cloud-pubsub==1.7.0")
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
session.run("pytest", "system_tests_sync/test_grpc.py")

Expand Down
Binary file added BIN +10.1 KB system_tests/secrets.tar.enc
Binary file not shown.
Empty file.
3 changes: 2 additions & 1 deletion 3 system_tests/system_tests_async/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ async def _token_info(access_token=None, id_token=None):
url = _helpers.update_query(sync_conftest.TOKEN_INFO_URL, query_params)

response = await http_request(url=url, method="GET")
data = await response.data.read()

data = await response.content()

return json.loads(data.decode("utf-8"))

Expand Down
5 changes: 2 additions & 3 deletions 5 system_tests/system_tests_async/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
import os
import pytest

import google.auth
from google.auth import _default_async

EXPECT_PROJECT_ID = os.environ.get("EXPECT_PROJECT_ID")

@pytest.mark.asyncio
async def test_application_default_credentials(verify_refresh):
credentials, project_id = google.auth.default_async()
#breakpoint()
credentials, project_id = _default_async.default_async()

if EXPECT_PROJECT_ID is not None:
assert project_id is not None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
urllib3
# Relative path to google-auth-python's source.
../..
../../..
Binary file modified BIN +0 Bytes (100%) system_tests/system_tests_sync/secrets.tar.enc
Binary file not shown.
23 changes: 3 additions & 20 deletions 23 system_tests/system_tests_sync/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import google.auth.jwt
import google.auth.transport.grpc
from google.cloud import pubsub_v1
from google.cloud.pubsub_v1.gapic import publisher_client
from google.cloud.pubsub_v1.gapic.transports import publisher_grpc_transport


def test_grpc_request_with_regular_credentials(http_request):
Expand All @@ -27,13 +25,8 @@ def test_grpc_request_with_regular_credentials(http_request):
credentials, ["https://www.googleapis.com/auth/pubsub"]
)

transport = publisher_grpc_transport.PublisherGrpcTransport(
address=publisher_client.PublisherClient.SERVICE_ADDRESS,
credentials=credentials,
)

# Create a pub/sub client.
client = pubsub_v1.PublisherClient(transport=transport)
client = pubsub_v1.PublisherClient(credentials=credentials)

# list the topics and drain the iterator to test that an authorized API
# call works.
Expand All @@ -48,13 +41,8 @@ def test_grpc_request_with_jwt_credentials():
credentials, audience=audience
)

transport = publisher_grpc_transport.PublisherGrpcTransport(
address=publisher_client.PublisherClient.SERVICE_ADDRESS,
credentials=credentials,
)

# Create a pub/sub client.
client = pubsub_v1.PublisherClient(transport=transport)
client = pubsub_v1.PublisherClient(credentials=credentials)

# list the topics and drain the iterator to test that an authorized API
# call works.
Expand All @@ -68,13 +56,8 @@ def test_grpc_request_with_on_demand_jwt_credentials():
credentials
)

transport = publisher_grpc_transport.PublisherGrpcTransport(
address=publisher_client.PublisherClient.SERVICE_ADDRESS,
credentials=credentials,
)

# Create a pub/sub client.
client = pubsub_v1.PublisherClient(transport=transport)
client = pubsub_v1.PublisherClient(credentials=credentials)

# list the topics and drain the iterator to test that an authorized API
# call works.
Expand Down
5 changes: 4 additions & 1 deletion 5 system_tests/system_tests_sync/test_mtls_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
# limitations under the License.

import json
from os import path
import mock
import os
import time
from os import path


import google.auth
import google.auth.credentials
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.