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:
idafurjes
2021-07-19 11:32:33 +02:00
committed by GitHub
co-authored by Gábor Farkas
parent 27b7c35ccc
commit cec12676e7
15 changed files with 525 additions and 444 deletions
+3 -5
View File
@@ -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)