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
4a116ad4
Commit
4a116ad4
authored
Oct 01, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(build): fixed failing unit test
parent
4ec2377e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
pkg/services/sqlstore/datasource.go
+1
-2
pkg/services/sqlstore/datasource_test.go
+7
-2
No files found.
pkg/services/sqlstore/datasource.go
View file @
4a116ad4
...
@@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
...
@@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
func
AddDataSource
(
cmd
*
m
.
AddDataSourceCommand
)
error
{
func
AddDataSource
(
cmd
*
m
.
AddDataSourceCommand
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
existing
:=
m
.
DataSource
{
OrgId
:
cmd
.
OrgId
,
Name
:
cmd
.
Name
}
existing
:=
m
.
DataSource
{
OrgId
:
cmd
.
OrgId
,
Name
:
cmd
.
Name
}
has
,
_
:=
x
.
Get
(
&
existing
)
has
,
_
:=
sess
.
Get
(
&
existing
)
if
has
{
if
has
{
return
m
.
ErrDataSourceNameExists
return
m
.
ErrDataSourceNameExists
...
...
pkg/services/sqlstore/datasource_test.go
View file @
4a116ad4
...
@@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) {
...
@@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) {
err
:=
AddDataSource
(
&
m
.
AddDataSourceCommand
{
err
:=
AddDataSource
(
&
m
.
AddDataSourceCommand
{
OrgId
:
10
,
OrgId
:
10
,
Name
:
"laban"
,
Type
:
m
.
DS_INFLUXDB
,
Type
:
m
.
DS_INFLUXDB
,
Access
:
m
.
DS_ACCESS_DIRECT
,
Access
:
m
.
DS_ACCESS_DIRECT
,
Url
:
"http://test"
,
Url
:
"http://test"
,
...
@@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) {
...
@@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) {
Convey
(
"Given a datasource"
,
func
()
{
Convey
(
"Given a datasource"
,
func
()
{
AddDataSource
(
&
m
.
AddDataSourceCommand
{
err
:=
AddDataSource
(
&
m
.
AddDataSourceCommand
{
OrgId
:
10
,
OrgId
:
10
,
Name
:
"nisse"
,
Type
:
m
.
DS_GRAPHITE
,
Type
:
m
.
DS_GRAPHITE
,
Access
:
m
.
DS_ACCESS_DIRECT
,
Access
:
m
.
DS_ACCESS_DIRECT
,
Url
:
"http://test"
,
Url
:
"http://test"
,
})
})
So
(
err
,
ShouldBeNil
)
query
:=
m
.
GetDataSourcesQuery
{
OrgId
:
10
}
query
:=
m
.
GetDataSourcesQuery
{
OrgId
:
10
}
GetDataSources
(
&
query
)
err
=
GetDataSources
(
&
query
)
So
(
err
,
ShouldBeNil
)
ds
:=
query
.
Result
[
0
]
ds
:=
query
.
Result
[
0
]
Convey
(
"Can delete datasource"
,
func
()
{
Convey
(
"Can delete datasource"
,
func
()
{
...
...
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