mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(build): fixed failing unit test
This commit is contained in:
parent
4ec2377e09
commit
4a116ad4ad
@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
|
||||
func AddDataSource(cmd *m.AddDataSourceCommand) error {
|
||||
|
||||
return inTransaction(func(sess *xorm.Session) error {
|
||||
|
||||
existing := m.DataSource{OrgId: cmd.OrgId, Name: cmd.Name}
|
||||
has, _ := x.Get(&existing)
|
||||
has, _ := sess.Get(&existing)
|
||||
|
||||
if has {
|
||||
return m.ErrDataSourceNameExists
|
||||
|
@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) {
|
||||
|
||||
err := AddDataSource(&m.AddDataSourceCommand{
|
||||
OrgId: 10,
|
||||
Name: "laban",
|
||||
Type: m.DS_INFLUXDB,
|
||||
Access: m.DS_ACCESS_DIRECT,
|
||||
Url: "http://test",
|
||||
@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) {
|
||||
|
||||
Convey("Given a datasource", func() {
|
||||
|
||||
AddDataSource(&m.AddDataSourceCommand{
|
||||
err := AddDataSource(&m.AddDataSourceCommand{
|
||||
OrgId: 10,
|
||||
Name: "nisse",
|
||||
Type: m.DS_GRAPHITE,
|
||||
Access: m.DS_ACCESS_DIRECT,
|
||||
Url: "http://test",
|
||||
})
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
query := m.GetDataSourcesQuery{OrgId: 10}
|
||||
GetDataSources(&query)
|
||||
err = GetDataSources(&query)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ds := query.Result[0]
|
||||
|
||||
Convey("Can delete datasource", func() {
|
||||
|
Loading…
Reference in New Issue
Block a user