File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
packages/google-cloud-compute Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ def system(session):
138138 )
139139 session .install ("-e" , "." )
140140
141+ # If mtls is enabled via environment variable
142+ # GOOGLE_API_USE_CLIENT_CERTIFICATE, then pyopenssl is needed. Here we
143+ # install it regardless.
144+ session .install ("pyopenssl" )
145+
141146 # Run py.test against the system tests.
142147 if system_test_exists :
143148 session .run ("py.test" , "--quiet" , system_test_path , * session .posargs )
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ #
3+ # Copyright 2021 Google LLC
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # https://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ import os
18+ import pytest
19+
20+ from google .cloud import compute
21+
22+
23+ @pytest .fixture (scope = "session" )
24+ def project_id ():
25+ return os .environ ["PROJECT_ID" ]
26+
27+
28+ def test_list_instances_not_throw_mtls (project_id ):
29+ client = compute .InstancesClient ()
30+
31+ # For regular system testing, the following call should never throw.
32+ # For mTLS testing, the call throws if mTLS is not properly configured.
33+ client .list (project = project_id , zone = "us-west1-a" )
You can’t perform that action at this time.
0 commit comments