stats_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package sqlstore
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/grafana/grafana/pkg/models"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestStatsDataAccess(t *testing.T) {
  9. Convey("Testing Stats Data Access", t, func() {
  10. InitTestDB(t)
  11. Convey("Get system stats should not results in error", func() {
  12. query := models.GetSystemStatsQuery{}
  13. err := GetSystemStats(&query)
  14. So(err, ShouldBeNil)
  15. })
  16. Convey("Get system user count stats should not results in error", func() {
  17. query := models.GetSystemUserCountStatsQuery{}
  18. err := GetSystemUserCountStats(context.Background(), &query)
  19. So(err, ShouldBeNil)
  20. })
  21. Convey("Get datasource stats should not results in error", func() {
  22. query := models.GetDataSourceStatsQuery{}
  23. err := GetDataSourceStats(&query)
  24. So(err, ShouldBeNil)
  25. })
  26. Convey("Get datasource access stats should not results in error", func() {
  27. query := models.GetDataSourceAccessStatsQuery{}
  28. err := GetDataSourceAccessStats(&query)
  29. So(err, ShouldBeNil)
  30. })
  31. Convey("Get alert notifier stats should not results in error", func() {
  32. query := models.GetAlertNotifierUsageStatsQuery{}
  33. err := GetAlertNotifiersUsageStats(context.Background(), &query)
  34. So(err, ShouldBeNil)
  35. })
  36. Convey("Get admin stats should not result in error", func() {
  37. query := models.GetAdminStatsQuery{}
  38. err := GetAdminStats(&query)
  39. So(err, ShouldBeNil)
  40. })
  41. })
  42. }