mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Provisioning: Validate that datasource access field equals to direct or proxy (#26440)
* Validate that datasource access field equals to allowed value (direct or proxy)
This commit is contained in:
@@ -22,6 +22,7 @@ var (
|
||||
brokenYaml = "testdata/broken-yaml"
|
||||
multipleOrgsWithDefault = "testdata/multiple-org-default"
|
||||
withoutDefaults = "testdata/appliedDefaults"
|
||||
invalidAccess = "testdata/invalid-access"
|
||||
|
||||
fakeRepo *fakeRepository
|
||||
)
|
||||
@@ -149,6 +150,13 @@ func TestDatasourceAsConfig(t *testing.T) {
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("invalid access should warn about invalid value and return 'proxy'", func() {
|
||||
reader := &configReader{log: logger}
|
||||
configs, err := reader.readConfig(invalidAccess)
|
||||
So(err, ShouldBeNil)
|
||||
So(configs[0].Datasources[0].Access, ShouldEqual, models.DS_ACCESS_PROXY)
|
||||
})
|
||||
|
||||
Convey("skip invalid directory", func() {
|
||||
cfgProvider := &configReader{log: log.New("test logger")}
|
||||
cfg, err := cfgProvider.readConfig("./invalid-directory")
|
||||
|
||||
Reference in New Issue
Block a user