API: Query database from /api/health endpoint (#28349)
This commit is contained in:
@@ -10,5 +10,6 @@ func init() {
|
||||
}
|
||||
|
||||
func GetDBHealthQuery(query *models.GetDBHealthQuery) error {
|
||||
return x.Ping()
|
||||
_, err := x.Exec("SELECT 1")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// +build integration
|
||||
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetDBHealthQuery(t *testing.T) {
|
||||
InitTestDB(t)
|
||||
|
||||
query := models.GetDBHealthQuery{}
|
||||
err := GetDBHealthQuery(&query)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user