Chore: Refactor influxdb to use SDK contracts (#36189)
* Use backend SDK for influxdb * Remove BasicAuth condition, some comments * Remove not used fields from datasource info * Register InfluxDBService * Fix casting and make HTTPClientProvider exported * Remove unused function * Remove empty line * Update pkg/tsdb/influxdb/flux/query_models.go Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com> * Read interval from TimeRange instead of Interval * Change pkg name from datasource->models, minor changes * Use testify instead of convey * Add new calculator logic and fix pointer semantic for dsInfo * Initialise parsers, use tsdb interval pkg Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
co-authored by
Gábor Farkas
parent
27b7c35ccc
commit
cec12676e7
@@ -5,15 +5,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/tsdb/influxdb/models"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestInfluxdbQueryParser_Parse(t *testing.T) {
|
||||
parser := &InfluxdbQueryParser{}
|
||||
dsInfo := &models.DataSource{
|
||||
JsonData: simplejson.New(),
|
||||
}
|
||||
dsInfo := &models.DatasourceInfo{}
|
||||
|
||||
t.Run("can parse influxdb json model", func(t *testing.T) {
|
||||
json := `
|
||||
@@ -105,7 +103,7 @@ func TestInfluxdbQueryParser_Parse(t *testing.T) {
|
||||
]
|
||||
}
|
||||
`
|
||||
dsInfo.JsonData.Set("timeInterval", ">20s")
|
||||
dsInfo.TimeInterval = ">20s"
|
||||
modelJSON, err := simplejson.NewJson([]byte(json))
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user