diff --git a/Makefile b/Makefile index cc65954b08c..986a5ce06b1 100644 --- a/Makefile +++ b/Makefile @@ -452,7 +452,7 @@ install-tools: install-test-tools install-build-tools install-ci: install-test-tools install-build-tools .PHONY: test-ci -#test-ci: GOTEST := $(GOTEST_QUIET) -json +test-ci: GOTEST := $(GOTEST_QUIET) -json test-ci: install-test-tools build-examples cover .PHONY: test-report diff --git a/cmd/query/app/apiv3/grpc_gateway_test.go b/cmd/query/app/apiv3/grpc_gateway_test.go index 8dedeb69e0b..381308b71ad 100644 --- a/cmd/query/app/apiv3/grpc_gateway_test.go +++ b/cmd/query/app/apiv3/grpc_gateway_test.go @@ -289,11 +289,6 @@ func runGatewayGetTrace(t *testing.T, gw *testGateway, setupRequest func(*http.R func runGatewayFindTraces(t *testing.T, gw *testGateway, setupRequest func(*http.Request)) { trace, traceID := makeTestTrace() q, qp := mockFindQueries() - if !useHTTPGateway { - // grpc-gateway forces inbound timestamps into UTC, so simulate this here - qp.StartTimeMin = qp.StartTimeMin.UTC() - qp.StartTimeMax = qp.StartTimeMax.UTC() - } gw.reader. On("FindTraces", matchContext, qp). Return([]*model.Trace{trace}, nil).Once() diff --git a/cmd/query/app/apiv3/http_gateway_test.go b/cmd/query/app/apiv3/http_gateway_test.go index 0a69b50dce9..86300ff5b50 100644 --- a/cmd/query/app/apiv3/http_gateway_test.go +++ b/cmd/query/app/apiv3/http_gateway_test.go @@ -138,12 +138,16 @@ func TestHTTPGatewayGetTraceErrors(t *testing.T) { } func mockFindQueries() (url.Values, *spanstore.TraceQueryParameters) { - goodTime := time.Now().Truncate(time.Nanosecond) // truncated to reset monotonic clock + // mock performs deep comparison of the timestamps and can fail + // if they are different in the timezone or the monotonic clocks. + // To void that we truncate monotonic clock and force UTC timezone. + time1 := time.Now().UTC().Truncate(time.Nanosecond) + time2 := time1.Add(-time.Second).UTC().Truncate(time.Nanosecond) q := url.Values{} q.Set(paramServiceName, "foo") q.Set(paramOperationName, "bar") - q.Set(paramTimeMin, goodTime.Add(-time.Second).Format(time.RFC3339Nano)) - q.Set(paramTimeMax, goodTime.Format(time.RFC3339Nano)) + q.Set(paramTimeMin, time1.Format(time.RFC3339Nano)) + q.Set(paramTimeMax, time2.Format(time.RFC3339Nano)) q.Set(paramDurationMin, "1s") q.Set(paramDurationMax, "2s") q.Set(paramNumTraces, "10") @@ -151,8 +155,8 @@ func mockFindQueries() (url.Values, *spanstore.TraceQueryParameters) { return q, &spanstore.TraceQueryParameters{ ServiceName: "foo", OperationName: "bar", - StartTimeMin: goodTime.Add(-time.Second), - StartTimeMax: goodTime, + StartTimeMin: time1, + StartTimeMax: time2, DurationMin: 1 * time.Second, DurationMax: 2 * time.Second, NumTraces: 10,