aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-12-29 17:05:30 +0100
committerDmitry Vyukov <dvyukov@google.com>2025-12-29 19:18:08 +0000
commit941d9afc6cb86dd16abf3fcaff41adb8c713febe (patch)
treec87b5acd04447007a3bb790cf083a0f4ef79389d
parent4e4046797c6cc800680d898f94d7c1a3aae8803d (diff)
syz-cluster/pkg/db: don't drop test databases
This is not necessary, makes things slower, than is not working anyway: === RUN TestSeriesRepositoryUpdate spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled --- PASS: TestSeriesRepositoryUpdate (0.07s) === RUN TestSeriesInsertSession spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled --- PASS: TestSeriesInsertSession (0.11s) === RUN TestQueryWaitingSessions spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled --- PASS: TestQueryWaitingSessions (0.12s) === RUN TestSessionTestRepository spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled --- PASS: TestSessionTestRepository (0.09s) === RUN TestMigrations spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled --- PASS: TestMigrations (0.15s) === RUN TestStatsSQLs spanner.go:168: failed to drop the test DB: rpc error: code = Canceled desc = context canceled
-rw-r--r--syz-cluster/pkg/db/spanner.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/syz-cluster/pkg/db/spanner.go b/syz-cluster/pkg/db/spanner.go
index 11933961a..1e6313fbf 100644
--- a/syz-cluster/pkg/db/spanner.go
+++ b/syz-cluster/pkg/db/spanner.go
@@ -19,9 +19,9 @@ import (
"time"
"cloud.google.com/go/spanner"
- database "cloud.google.com/go/spanner/admin/database/apiv1"
+ "cloud.google.com/go/spanner/admin/database/apiv1"
"cloud.google.com/go/spanner/admin/database/apiv1/databasepb"
- instance "cloud.google.com/go/spanner/admin/instance/apiv1"
+ "cloud.google.com/go/spanner/admin/instance/apiv1"
"cloud.google.com/go/spanner/admin/instance/apiv1/instancepb"
"github.com/golang-migrate/migrate/v4"
migrate_spanner "github.com/golang-migrate/migrate/v4/database/spanner"
@@ -93,15 +93,6 @@ func CreateSpannerDB(ctx context.Context, uri ParsedURI) error {
return err
}
-func dropSpannerDB(ctx context.Context, uri ParsedURI) error {
- client, err := database.NewDatabaseAdminClient(ctx)
- if err != nil {
- return err
- }
- defer client.Close()
- return client.DropDatabase(ctx, &databasepb.DropDatabaseRequest{Database: uri.Full})
-}
-
//go:embed migrations/*.sql
var migrationsFs embed.FS
@@ -162,12 +153,6 @@ func NewTransientDB(t *testing.T) (*spanner.Client, context.Context) {
if err != nil {
t.Fatal(err)
}
- t.Cleanup(func() {
- err := dropSpannerDB(ctx, uri)
- if err != nil {
- t.Logf("failed to drop the test DB: %v", err)
- }
- })
client, err := spanner.NewClient(ctx, uri.Full)
if err != nil {
t.Fatal(err)