fix: add system tests and cert/key by arithmetic1728 · Pull Request #394 · googleapis/gapic-generator-python · GitHub
Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
108 changes: 106 additions & 2 deletions .circleci/config.yml
62 changes: 62 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def showcase(
session.log('-' * 70)

# Install pytest and gapic-generator-python
session.install('mock')
session.install('pytest')
session.install('-e', '.')

Expand Down Expand Up @@ -103,12 +104,73 @@ def showcase(
)


@nox.session(python='3.8')
def showcase_mtls(
session,
templates='DEFAULT',
other_opts: typing.Iterable[str] = (),
):
"""Run the Showcase mtls test suite."""

# Try to make it clear if Showcase is not running, so that
# people do not end up with tons of difficult-to-debug failures over
# an obvious problem.
if not os.environ.get('CIRCLECI'):
session.log('-' * 70)
session.log('Note: Showcase must be running for these tests to work.')
session.log('See https://github.com/googleapis/gapic-showcase')
session.log('-' * 70)

# Install pytest and gapic-generator-python
session.install('mock')
session.install('pytest')
session.install('-e', '.')

# Install a client library for Showcase.
with tempfile.TemporaryDirectory() as tmp_dir:
# Download the Showcase descriptor.
session.run(
'curl', 'https://github.com/googleapis/gapic-showcase/releases/'
f'download/v{showcase_version}/'
f'gapic-showcase-{showcase_version}.desc',
'-L', '--output', path.join(tmp_dir, 'showcase.desc'),
external=True,
silent=True,
)

# Write out a client library for Showcase.
template_opt = f'python-gapic-templates={templates}'
opts = f'--python_gapic_opt={template_opt}'
opts += ','.join(other_opts + ('lazy-import',))
session.run(
'protoc',
f'--descriptor_set_in={tmp_dir}{path.sep}showcase.desc',
f'--python_gapic_out={tmp_dir}',
'google/showcase/v1beta1/echo.proto',
'google/showcase/v1beta1/identity.proto',
external=True,
)

# Install the library.
session.install(tmp_dir)

session.run(
'py.test', '--quiet', '--mtls', *(session.posargs or [path.join('tests', 'system')])
)


@nox.session(python='3.8')
def showcase_alternative_templates(session):
templates = path.join(path.dirname(__file__), 'gapic', 'ads-templates')
showcase(session, templates=templates, other_opts=('old-naming',))


@nox.session(python='3.8')
def showcase_mtls_alternative_templates(session):
templates = path.join(path.dirname(__file__), 'gapic', 'ads-templates')
showcase_mtls(session, templates=templates, other_opts=('old-naming',))


@nox.session(python=['3.6', '3.7', '3.8'])
def showcase_unit(
session,
Expand Down
21 changes: 21 additions & 0 deletions tests/cert/mtls.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDbDCCAlSgAwIBAgIJALV2ZblaPmp2MA0GCSqGSIb3DQEBCwUAMEoxCzAJBgNV
BAYTAlVTMRMwEQYDVQQIDApTb21lLVN0YXRlMRIwEAYDVQQKDAlsb2NhbGhvc3Qx
EjAQBgNVBAMMCWxvY2FsaG9zdDAgFw0yMDA0MTUwNjE2NDRaGA8zMDE5MDgxNzA2
MTY0NFowSjELMAkGA1UEBhMCVVMxEzARBgNVBAgMClNvbWUtU3RhdGUxEjAQBgNV
BAoMCWxvY2FsaG9zdDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B
AQEFAAOCAQ8AMIIBCgKCAQEAxOcBZ3f679mn90KA7RzBTr8zwKqcI/7OcJ2GooZh
JvZpD/M6TqhopIgf29O082QrJZLo29lSyVtufTalmg9U4lNDFPAm/BvX7ydaHSdN
FZzn1BInhqvtBXMOy1nGegr4QtgdFSlShuhT8Lo3XxMERP+/Nhyv8wPEy+MTxym3
WxbJPPhsmQQ42gIgRyqWHVbj6vpCRHp7l81Kh+/wcbC+C/5ARw0vgPIDAAk9iWBU
TJS1q0ghUZyITeafw6fMVqgMAT7vM2WZzfOeOsLunm3t4DQCsJxFrvKQkgi3loXa
MueqepuF0UZIChg/o4k6ecJ2qxD7ad04UsvX1pRBvKKvNQIDAQABo1MwUTAdBgNV
HQ4EFgQUwq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