|
@@ -4,43 +4,48 @@ import (
|
|
|
"context"
|
|
"context"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
|
|
- m "github.com/grafana/grafana/pkg/models"
|
|
|
|
|
|
|
+ "github.com/grafana/grafana/pkg/models"
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func TestStatsDataAccess(t *testing.T) {
|
|
func TestStatsDataAccess(t *testing.T) {
|
|
|
-
|
|
|
|
|
Convey("Testing Stats Data Access", t, func() {
|
|
Convey("Testing Stats Data Access", t, func() {
|
|
|
InitTestDB(t)
|
|
InitTestDB(t)
|
|
|
|
|
|
|
|
Convey("Get system stats should not results in error", func() {
|
|
Convey("Get system stats should not results in error", func() {
|
|
|
- query := m.GetSystemStatsQuery{}
|
|
|
|
|
|
|
+ query := models.GetSystemStatsQuery{}
|
|
|
err := GetSystemStats(&query)
|
|
err := GetSystemStats(&query)
|
|
|
So(err, ShouldBeNil)
|
|
So(err, ShouldBeNil)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Get system user count stats should not results in error", func() {
|
|
Convey("Get system user count stats should not results in error", func() {
|
|
|
- query := m.GetSystemUserCountStatsQuery{}
|
|
|
|
|
|
|
+ query := models.GetSystemUserCountStatsQuery{}
|
|
|
err := GetSystemUserCountStats(context.Background(), &query)
|
|
err := GetSystemUserCountStats(context.Background(), &query)
|
|
|
So(err, ShouldBeNil)
|
|
So(err, ShouldBeNil)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Get datasource stats should not results in error", func() {
|
|
Convey("Get datasource stats should not results in error", func() {
|
|
|
- query := m.GetDataSourceStatsQuery{}
|
|
|
|
|
|
|
+ query := models.GetDataSourceStatsQuery{}
|
|
|
err := GetDataSourceStats(&query)
|
|
err := GetDataSourceStats(&query)
|
|
|
So(err, ShouldBeNil)
|
|
So(err, ShouldBeNil)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Get datasource access stats should not results in error", func() {
|
|
Convey("Get datasource access stats should not results in error", func() {
|
|
|
- query := m.GetDataSourceAccessStatsQuery{}
|
|
|
|
|
|
|
+ query := models.GetDataSourceAccessStatsQuery{}
|
|
|
err := GetDataSourceAccessStats(&query)
|
|
err := GetDataSourceAccessStats(&query)
|
|
|
So(err, ShouldBeNil)
|
|
So(err, ShouldBeNil)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Get alert notifier stats should not results in error", func() {
|
|
Convey("Get alert notifier stats should not results in error", func() {
|
|
|
- query := m.GetAlertNotifierUsageStatsQuery{}
|
|
|
|
|
|
|
+ query := models.GetAlertNotifierUsageStatsQuery{}
|
|
|
err := GetAlertNotifiersUsageStats(context.Background(), &query)
|
|
err := GetAlertNotifiersUsageStats(context.Background(), &query)
|
|
|
So(err, ShouldBeNil)
|
|
So(err, ShouldBeNil)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ Convey("Get admin stats should not result in error", func() {
|
|
|
|
|
+ query := models.GetAdminStatsQuery{}
|
|
|
|
|
+ err := GetAdminStats(&query)
|
|
|
|
|
+ So(err, ShouldBeNil)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|