Support creating temporary Spanner databases for integration tests. (#103347)

* Support creating temporary Spanner databases for integration tests.
This commit is contained in:
Peter Štibraný
2025-04-07 12:15:16 +02:00
committed by GitHub
parent 23fa739a13
commit 68c6e88b00
2 changed files with 146 additions and 7 deletions
@@ -5,12 +5,13 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"xorm.io/xorm"
)
@@ -23,7 +24,7 @@ func TestIntegrationTempDatabaseConnect(t *testing.T) {
sqlStore := sqlstore.NewTestStore(t, sqlstore.WithoutMigrator())
err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
_, err := sess.Exec("SELECT 1")
_, err := sess.Query("SELECT 1")
return err
})
require.NoError(t, err, "failed to execute a SELECT 1")