From 0d8c6c0888a602846673f57e33a5b44165d99c13 Mon Sep 17 00:00:00 2001 From: Ed Snible Date: Tue, 12 Jul 2022 08:27:38 -0400 Subject: [PATCH] Factor out rendundent test function Signed-off-by: Ed Snible --- cmd/query/app/grpc_handler_test.go | 41 +----------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/cmd/query/app/grpc_handler_test.go b/cmd/query/app/grpc_handler_test.go index e28a81da095..fbdbe108978 100644 --- a/cmd/query/app/grpc_handler_test.go +++ b/cmd/query/app/grpc_handler_test.go @@ -202,47 +202,8 @@ func withMetricsQuery() testOption { } } -func initializeTestServerGRPCWithOptions(t *testing.T, options ...testOption) *grpcServer { - archiveSpanReader := &spanstoremocks.Reader{} - archiveSpanWriter := &spanstoremocks.Writer{} - - spanReader := &spanstoremocks.Reader{} - dependencyReader := &depsmocks.Reader{} - disabledReader, err := disabled.NewMetricsReader() - require.NoError(t, err) - - q := querysvc.NewQueryService(spanReader, dependencyReader, - querysvc.QueryServiceOptions{ - ArchiveSpanReader: archiveSpanReader, - ArchiveSpanWriter: archiveSpanWriter, - }) - - tqs := &testQueryService{ - // Disable metrics query by default. - metricsQueryService: disabledReader, - } - for _, opt := range options { - opt(tqs) - } - - logger := zap.NewNop() - tracer := opentracing.NoopTracer{} - - server, addr := newGRPCServer(t, q, tqs.metricsQueryService, logger, tracer, &tenancy.TenancyConfig{}) - - return &grpcServer{ - server: server, - lisAddr: addr, - spanReader: spanReader, - depReader: dependencyReader, - metricsQueryService: tqs.metricsQueryService, - archiveSpanReader: archiveSpanReader, - archiveSpanWriter: archiveSpanWriter, - } -} - func withServerAndClient(t *testing.T, actualTest func(server *grpcServer, client *grpcClient), options ...testOption) { - server := initializeTestServerGRPCWithOptions(t, options...) + server := initializeTenantedTestServerGRPCWithOptions(t, &tenancy.TenancyConfig{}, options...) client := newGRPCClient(t, server.lisAddr.String()) defer server.server.Stop() defer client.conn.Close()