2018-05-25 20:33:37 +08:00
|
|
|
package sqlstore
|
|
|
|
|
|
|
|
|
|
import (
|
2018-06-11 05:17:18 +08:00
|
|
|
"context"
|
2018-05-25 20:33:37 +08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestStatsDataAccess(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
Convey("Testing Stats Data Access", t, func() {
|
|
|
|
|
InitTestDB(t)
|
|
|
|
|
|
|
|
|
|
Convey("Get system stats should not results in error", func() {
|
|
|
|
|
query := m.GetSystemStatsQuery{}
|
|
|
|
|
err := GetSystemStats(&query)
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Convey("Get system user count stats should not results in error", func() {
|
|
|
|
|
query := m.GetSystemUserCountStatsQuery{}
|
2018-06-11 05:17:18 +08:00
|
|
|
err := GetSystemUserCountStats(context.Background(), &query)
|
2018-05-25 20:33:37 +08:00
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
})
|
2018-05-25 22:00:15 +08:00
|
|
|
|
|
|
|
|
Convey("Get datasource stats should not results in error", func() {
|
|
|
|
|
query := m.GetDataSourceStatsQuery{}
|
|
|
|
|
err := GetDataSourceStats(&query)
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Convey("Get datasource access stats should not results in error", func() {
|
|
|
|
|
query := m.GetDataSourceAccessStatsQuery{}
|
|
|
|
|
err := GetDataSourceAccessStats(&query)
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
})
|
2018-09-07 03:03:09 +08:00
|
|
|
|
|
|
|
|
Convey("Get alert notifier stats should not results in error", func() {
|
|
|
|
|
query := m.GetAlertNotifierUsageStatsQuery{}
|
|
|
|
|
err := GetAlertNotifiersUsageStats(context.Background(), &query)
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
})
|
2018-05-25 20:33:37 +08:00
|
|
|
})
|
|
|
|
|
}
|