|
|
|
@ -117,21 +117,28 @@ def compute_engine_channel_credentials(request): |
|
|
|
|
class TestCallCredentials(grpc.AuthMetadataPlugin): |
|
|
|
|
def __call__(self, context, callback): |
|
|
|
|
callback((), None) |
|
|
|
|
|
|
|
|
|
test_call_credentials = TestCallCredentials() |
|
|
|
|
call_credentials = grpc.metadata_call_credentials( |
|
|
|
|
test_call_credentials, "test call credentials" |
|
|
|
|
) |
|
|
|
|
request.cls.compute_engine_channel_credentials = grpc.compute_engine_channel_credentials(call_credentials) |
|
|
|
|
request.cls.compute_engine_channel_credentials = ( |
|
|
|
|
grpc.compute_engine_channel_credentials(call_credentials) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures("compute_engine_channel_credentials") |
|
|
|
|
class ChannelTest(unittest.TestCase): |
|
|
|
|
def test_ssl_secure_channel(self): |
|
|
|
|
channel = grpc.secure_channel("google.com:443", grpc.ssl_channel_credentials()) |
|
|
|
|
channel = grpc.secure_channel( |
|
|
|
|
"google.com:443", grpc.ssl_channel_credentials() |
|
|
|
|
) |
|
|
|
|
channel.close() |
|
|
|
|
|
|
|
|
|
def test_compute_engine_secure_channel(self): |
|
|
|
|
channel = grpc.secure_channel("google.com:443", self.compute_engine_channel_credentials) |
|
|
|
|
channel = grpc.secure_channel( |
|
|
|
|
"google.com:443", self.compute_engine_channel_credentials |
|
|
|
|
) |
|
|
|
|
channel.close() |
|
|
|
|
|
|
|
|
|
def test_multiple_ssl_secure_channel(self): |
|
|
|
@ -141,7 +148,9 @@ class ChannelTest(unittest.TestCase): |
|
|
|
|
def create_secure_channel(): |
|
|
|
|
wait_group.done() |
|
|
|
|
wait_group.wait() |
|
|
|
|
channel = grpc.secure_channel("google.com:443", grpc.ssl_channel_credentials()) |
|
|
|
|
channel = grpc.secure_channel( |
|
|
|
|
"google.com:443", grpc.ssl_channel_credentials() |
|
|
|
|
) |
|
|
|
|
channel.close() |
|
|
|
|
|
|
|
|
|
threads = [] |
|
|
|
@ -161,7 +170,9 @@ class ChannelTest(unittest.TestCase): |
|
|
|
|
def create_secure_channel(): |
|
|
|
|
wait_group.done() |
|
|
|
|
wait_group.wait() |
|
|
|
|
channel = grpc.secure_channel("google.com:443", self.compute_engine_channel_credentials) |
|
|
|
|
channel = grpc.secure_channel( |
|
|
|
|
"google.com:443", self.compute_engine_channel_credentials |
|
|
|
|
) |
|
|
|
|
channel.close() |
|
|
|
|
|
|
|
|
|
threads = [] |
|
|
|
|