From bcdc86d2a5eb8f7fbee0bd074aeadfe8fef10efc Mon Sep 17 00:00:00 2001 From: Mahad Zaryab Date: Fri, 6 Dec 2024 17:38:04 -0500 Subject: [PATCH] Fix Tests Signed-off-by: Mahad Zaryab --- cmd/anonymizer/app/query/query_test.go | 2 +- .../internal/extension/jaegerquery/server_test.go | 2 +- cmd/query/app/apiv3/grpc_handler_test.go | 2 +- cmd/query/app/apiv3/http_gateway_test.go | 2 +- cmd/query/app/http_handler_test.go | 2 +- cmd/query/app/querysvc/query_service.go | 11 +++++++---- cmd/query/app/querysvc/query_service_test.go | 9 ++++++--- cmd/query/app/server_test.go | 2 +- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/cmd/anonymizer/app/query/query_test.go b/cmd/anonymizer/app/query/query_test.go index 24352622e54..768dbc3c1fb 100644 --- a/cmd/anonymizer/app/query/query_test.go +++ b/cmd/anonymizer/app/query/query_test.go @@ -18,9 +18,9 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/plugin/metricstore/disabled" "github.com/jaegertracing/jaeger/proto-gen/api_v2" - dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) diff --git a/cmd/jaeger/internal/extension/jaegerquery/server_test.go b/cmd/jaeger/internal/extension/jaegerquery/server_test.go index 70e60d78768..f5d16c2dd45 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server_test.go @@ -150,7 +150,7 @@ func TestServerStart(t *testing.T) { TracesPrimary: "need-factory-error", }, }, - expectedErr: "cannot find v1 factory for primary storage", + expectedErr: "cannot find factory for primary storage", }, { name: "span reader error", diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index b14f1c01abf..6534df23fe6 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -20,9 +20,9 @@ import ( "github.com/jaegertracing/jaeger/cmd/query/app/querysvc" "github.com/jaegertracing/jaeger/model" _ "github.com/jaegertracing/jaeger/pkg/gogocodec" // force gogo codec registration - dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) diff --git a/cmd/query/app/apiv3/http_gateway_test.go b/cmd/query/app/apiv3/http_gateway_test.go index 5f742a0522f..f0abbeb3307 100644 --- a/cmd/query/app/apiv3/http_gateway_test.go +++ b/cmd/query/app/apiv3/http_gateway_test.go @@ -22,9 +22,9 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/pkg/testutils" - dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + dependencyStoreMocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) diff --git a/cmd/query/app/http_handler_test.go b/cmd/query/app/http_handler_test.go index dfa54f6701a..511495193c3 100644 --- a/cmd/query/app/http_handler_test.go +++ b/cmd/query/app/http_handler_test.go @@ -38,10 +38,10 @@ import ( "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/metricstore/disabled" "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics" - depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" metricsmocks "github.com/jaegertracing/jaeger/storage/metricstore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" ) diff --git a/cmd/query/app/querysvc/query_service.go b/cmd/query/app/querysvc/query_service.go index f627c3c8344..1a34cd1e408 100644 --- a/cmd/query/app/querysvc/query_service.go +++ b/cmd/query/app/querysvc/query_service.go @@ -13,8 +13,8 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/model/adjuster" "github.com/jaegertracing/jaeger/storage" - "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/jaegertracing/jaeger/storage_v2/depstore" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/tracestore" ) @@ -43,12 +43,12 @@ type StorageCapabilities struct { // QueryService contains span utils required by the query-service. type QueryService struct { traceReader tracestore.Reader - dependencyReader dependencystore.Reader + dependencyReader depstore.Reader options QueryServiceOptions } // NewQueryService returns a new QueryService. -func NewQueryService(traceReader tracestore.Reader, dependencyReader dependencystore.Reader, options QueryServiceOptions) *QueryService { +func NewQueryService(traceReader tracestore.Reader, dependencyReader depstore.Reader, options QueryServiceOptions) *QueryService { qsvc := &QueryService{ traceReader: traceReader, dependencyReader: dependencyReader, @@ -134,7 +134,10 @@ func (qs QueryService) Adjust(trace *model.Trace) (*model.Trace, error) { // GetDependencies implements dependencystore.Reader.GetDependencies func (qs QueryService) GetDependencies(ctx context.Context, endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { - return qs.dependencyReader.GetDependencies(ctx, endTs, lookback) + return qs.dependencyReader.GetDependencies(ctx, depstore.QueryParameters{ + StartTime: endTs.Add(-lookback), + EndTime: endTs, + }) } // GetCapabilities returns the features supported by the query service. diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go index 3a9f906d2b5..9cfd8ec6212 100644 --- a/cmd/query/app/querysvc/query_service_test.go +++ b/cmd/query/app/querysvc/query_service_test.go @@ -22,9 +22,10 @@ import ( "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/storage" "github.com/jaegertracing/jaeger/storage/dependencystore" - depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage_v2/depstore" + depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/tracestore" ) @@ -345,8 +346,10 @@ func TestGetDependencies(t *testing.T) { tqs.depsReader.On( "GetDependencies", mock.Anything, // context.Context - endTs, - defaultDependencyLookbackDuration).Return(expectedDependencies, nil).Times(1) + depstore.QueryParameters{ + StartTime: endTs.Add(-defaultDependencyLookbackDuration), + EndTime: endTs, + }).Return(expectedDependencies, nil).Times(1) actualDependencies, err := tqs.queryService.GetDependencies(context.Background(), time.Unix(0, 1476374248550*millisToNanosMultiplier), defaultDependencyLookbackDuration) require.NoError(t, err) diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index 51db8aeb239..fc2c0d298f0 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -39,8 +39,8 @@ import ( "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/proto-gen/api_v2" - depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + depsmocks "github.com/jaegertracing/jaeger/storage_v2/depstore/mocks" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" )