Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
7610d571
Unverified
Commit
7610d571
authored
May 14, 2020
by
Carl Bergquist
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provisioning: Use proxy as default access mode in provisioning (#24669)
fixes #24591 fixes #19501
parent
2f22781c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
pkg/services/provisioning/datasources/config_reader.go
+4
-0
pkg/services/provisioning/datasources/config_reader_test.go
+13
-0
pkg/services/provisioning/datasources/testdata/appliedDefaults/without-defaults.yaml
+5
-0
No files found.
pkg/services/provisioning/datasources/config_reader.go
View file @
7610d571
...
...
@@ -94,6 +94,10 @@ func validateDefaultUniqueness(datasources []*configs) error {
ds
.
OrgID
=
1
}
if
ds
.
Access
==
""
{
ds
.
Access
=
"proxy"
}
if
ds
.
IsDefault
{
defaultCount
[
ds
.
OrgID
]
=
defaultCount
[
ds
.
OrgID
]
+
1
if
defaultCount
[
ds
.
OrgID
]
>
1
{
...
...
pkg/services/provisioning/datasources/config_reader_test.go
View file @
7610d571
...
...
@@ -21,6 +21,7 @@ var (
versionZero
=
"testdata/version-0"
brokenYaml
=
"testdata/broken-yaml"
multipleOrgsWithDefault
=
"testdata/multiple-org-default"
withoutDefaults
=
"testdata/appliedDefaults"
fakeRepo
*
fakeRepository
)
...
...
@@ -35,6 +36,18 @@ func TestDatasourceAsConfig(t *testing.T) {
bus
.
AddHandler
(
"test"
,
mockGet
)
bus
.
AddHandler
(
"test"
,
mockGetAll
)
Convey
(
"apply default values when missing"
,
func
()
{
dc
:=
newDatasourceProvisioner
(
logger
)
err
:=
dc
.
applyChanges
(
withoutDefaults
)
if
err
!=
nil
{
t
.
Fatalf
(
"applyChanges return an error %v"
,
err
)
}
So
(
len
(
fakeRepo
.
inserted
),
ShouldEqual
,
1
)
So
(
fakeRepo
.
inserted
[
0
]
.
OrgId
,
ShouldEqual
,
1
)
So
(
fakeRepo
.
inserted
[
0
]
.
Access
,
ShouldEqual
,
"proxy"
)
})
Convey
(
"One configured datasource"
,
func
()
{
Convey
(
"no datasource in database"
,
func
()
{
dc
:=
newDatasourceProvisioner
(
logger
)
...
...
pkg/services/provisioning/datasources/testdata/appliedDefaults/without-defaults.yaml
0 → 100644
View file @
7610d571
apiVersion
:
1
datasources
:
-
name
:
$TEST_VAR
type
:
type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment