grafana/pkg/tsdb/tempo/tempo_test.go
2021-03-11 08:18:24 +01:00

24 lines
686 B
Go

package tempo
import (
"context"
"testing"
"github.com/grafana/grafana/pkg/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestTempo(t *testing.T) {
plug, err := NewExecutor(&models.DataSource{})
executor := plug.(*tempoExecutor)
require.NoError(t, err)
t.Run("createRequest should set Auth header when basic auth is true ", func(t *testing.T) {
req, err := executor.createRequest(context.Background(), &models.DataSource{BasicAuth: true, BasicAuthUser: "john", BasicAuthPassword: "pass"}, "traceID")
require.NoError(t, err)
assert.Equal(t, 2, len(req.Header))
assert.NotEqual(t, req.Header.Get("Authorization"), "")
})
}