def client(self): """Get an API client. Returns: object: API client to use against services. """ return ClientComposition(self.endpoint)
def Run(self, request, _): """Run Forseti inventory, scanner and notifier Args: request (ServerRunRequest): The grpc request object. _ (object): Context of the request. Returns: ServerRunReply: The ServerRunReply grpc object. """ LOGGER.info('Running the server processes, end-to-end.') client = ClientComposition() return _run(client)
def run(self, test_callback): """Test runner.""" server = grpc.server(futures.ThreadPoolExecutor(1)) server.add_insecure_port('[::]:{}'.format(self.service_port)) for factory in self.service_factories: try: factory( self.service_config).create_and_register_service(server) except Exception: # This is a workaround for a gRPC bug # that triggers an assertion if the server is gc'd # without ever being started. server.start() server.stop(0) raise server.start() try: client = ClientComposition( endpoint='localhost:{}'.format(self.service_port)) test_callback(client) finally: server.stop(0)
def client(self): return ClientComposition(self.endpoint)