mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
c1709c9301
* Refactor Tempo datasource backend to support multiple queryData types. Added traceId query type that is set when performing the request but doesn't map to a tab. * WIP data is reaching the frontend * WIP * Use channels and goroutines * Some fixes * Simplify backend code. Return traces, metrics, state and error in a dataframe. Shared state type between FE and BE. Use getStream() instead of getQueryData() * Handle errors in frontend * Update Tempo and use same URL for RPC and HTTP * Cleanup backend code * Merge main * Create grpc client only with host and authenticate * Create grpc client only with host and authenticate * Cleanup * Add streaming to TraceQL Search tab * Fix merge conflicts * Added tests for processStream * make gen-cue * make gen-cue * goimports * lint * Cleanup go.mod * Comments * Addressing PR comments * Fix streaming for tracel search tab * Added streaming kill switch as the disableTraceQLStreaming feature toggle * Small comment * Fix conflicts * Correctly capture and send all errors as a DF to client * Fix infinite error loop * Fix merge conflicts * Fix test * Update deprecated import * Fix feature toggles gen * Fix merge conflicts
28 lines
845 B
Go
28 lines
845 B
Go
package tempo
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/log"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestTempo(t *testing.T) {
|
|
t.Run("createRequest without time range - success", func(t *testing.T) {
|
|
service := &Service{logger: log.New("tempo-test")}
|
|
req, err := service.createRequest(context.Background(), &Datasource{}, "traceID", 0, 0)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 1, len(req.Header))
|
|
})
|
|
|
|
t.Run("createRequest with time range - success", func(t *testing.T) {
|
|
service := &Service{logger: log.New("tempo-test")}
|
|
req, err := service.createRequest(context.Background(), &Datasource{}, "traceID", 1, 2)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 1, len(req.Header))
|
|
assert.Equal(t, "/api/traces/traceID?start=1&end=2", req.URL.String())
|
|
})
|
|
}
|