def setUp(self) -> None: # Create a fake server for the VizierService self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=1)) self.fake_vizier_service = VizierServiceFake() self.fake_cloud_service = CloudServiceFake() vizierapi_pb2_grpc.add_VizierServiceServicer_to_server( self.fake_vizier_service, self.server) cloudapi_pb2_grpc.add_VizierClusterInfoServicer_to_server( self.fake_cloud_service, self.server) self.port = self.server.add_insecure_port("[::]:0") self.server.start() self.px_client = pxapi.Client( token=ACCESS_TOKEN, server_url=self.url(), channel_fn=lambda url: grpc.insecure_channel(url), conn_channel_fn=lambda url: grpc.aio.insecure_channel(url), ) self.http_table_factory = test_utils.FakeTableFactory( "http", vpb.Relation(columns=[ test_utils.string_col("http_resp_body"), test_utils.int64_col("http_resp_status"), ])) self.stats_table_factory = test_utils.FakeTableFactory( "stats", vpb.Relation(columns=[ test_utils.uint128_col("upid"), test_utils.int64_col("cpu_ktime_ns"), test_utils.int64_col("rss_bytes"), ])) asyncio.set_event_loop(asyncio.new_event_loop())
def setUp(self) -> None: self.relation = vpb.Relation(columns=[ utils.string_col("http_resp_body"), utils.int64_col("http_resp_status"), ])