2021-03-11 01:18:24 -06:00
|
|
|
package tempo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2021-05-19 16:53:41 -05:00
|
|
|
"github.com/grafana/grafana/pkg/infra/httpclient"
|
2021-03-11 01:18:24 -06:00
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTempo(t *testing.T) {
|
2021-05-19 16:53:41 -05:00
|
|
|
plug, err := New(httpclient.NewProvider())(&models.DataSource{})
|
2021-03-11 01:18:24 -06:00
|
|
|
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"), "")
|
|
|
|
})
|
|
|
|
}
|