From 873d35b494ac04fb624d2e81f4b5df8a827bd98a Mon Sep 17 00:00:00 2001 From: Will Assis <35489495+gassiss@users.noreply.github.com> Date: Wed, 14 Jan 2026 16:28:14 -0500 Subject: [PATCH] unified-storage: sqlkv enable more tests (#116150) * unified-storage: sqlkv enable more tests --- pkg/storage/unified/testing/storage_backend.go | 9 +++++++-- .../testing/storage_backend_sql_compatibility.go | 4 ++++ pkg/storage/unified/testing/storage_backend_test.go | 12 ++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pkg/storage/unified/testing/storage_backend.go b/pkg/storage/unified/testing/storage_backend.go index faf6b70c600..29279a16e97 100644 --- a/pkg/storage/unified/testing/storage_backend.go +++ b/pkg/storage/unified/testing/storage_backend.go @@ -23,6 +23,7 @@ import ( "github.com/grafana/authlib/types" "github.com/grafana/grafana/pkg/apimachinery/utils" + "github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/storage/unified/resource" "github.com/grafana/grafana/pkg/storage/unified/resourcepb" sqldb "github.com/grafana/grafana/pkg/storage/unified/sql/db" @@ -99,6 +100,10 @@ func RunStorageBackendTest(t *testing.T, newBackend NewBackendFunc, opts *TestOp } t.Run(tc.name, func(t *testing.T) { + if db.IsTestDbSQLite() { + t.Skip("Skipping tests on sqlite until channel notifier is implemented") + } + tc.fn(t, newBackend(context.Background()), opts.NSPrefix) }) } @@ -1166,7 +1171,7 @@ func runTestIntegrationBackendCreateNewResource(t *testing.T, backend resource.S })) server := newServer(t, backend) - ns := nsPrefix + "-create-resource" + ns := nsPrefix + "-create-rsrce" // create-resource ctx = request.WithNamespace(ctx, ns) request := &resourcepb.CreateRequest{ @@ -1607,7 +1612,7 @@ func (s *sliceBulkRequestIterator) RollbackRequested() bool { func runTestIntegrationBackendOptimisticLocking(t *testing.T, backend resource.StorageBackend, nsPrefix string) { ctx := testutil.NewTestContext(t, time.Now().Add(30*time.Second)) - ns := nsPrefix + "-optimistic-locking" + ns := nsPrefix + "-optimis-lock" // optimistic-locking. need to cut down on characters to not exceed namespace character limit (40) t.Run("concurrent updates with same RV - only one succeeds", func(t *testing.T) { // Create initial resource with rv0 (no previous RV) diff --git a/pkg/storage/unified/testing/storage_backend_sql_compatibility.go b/pkg/storage/unified/testing/storage_backend_sql_compatibility.go index d498ebba2f4..64184cbe23e 100644 --- a/pkg/storage/unified/testing/storage_backend_sql_compatibility.go +++ b/pkg/storage/unified/testing/storage_backend_sql_compatibility.go @@ -36,6 +36,10 @@ func NewTestSqlKvBackend(t *testing.T, ctx context.Context, withRvManager bool) KvStore: kv, } + if db.DriverName() == "sqlite3" { + kvOpts.UseChannelNotifier = true + } + if withRvManager { dialect := sqltemplate.DialectForDriver(db.DriverName()) rvManager, err := rvmanager.NewResourceVersionManager(rvmanager.ResourceManagerOptions{ diff --git a/pkg/storage/unified/testing/storage_backend_test.go b/pkg/storage/unified/testing/storage_backend_test.go index 236a6c510dc..96b9d5716db 100644 --- a/pkg/storage/unified/testing/storage_backend_test.go +++ b/pkg/storage/unified/testing/storage_backend_test.go @@ -41,17 +41,9 @@ func TestIntegrationSQLKVStorageBackend(t *testing.T) { testutil.SkipIntegrationTestInShortMode(t) skipTests := map[string]bool{ - TestWatchWriteEvents: true, - TestList: true, TestBlobSupport: true, - TestGetResourceStats: true, - TestListHistory: true, - TestListHistoryErrorReporting: true, TestListModifiedSince: true, - TestListTrash: true, - TestCreateNewResource: true, TestGetResourceLastImportTime: true, - TestOptimisticLocking: true, } t.Run("Without RvManager", func(t *testing.T) { @@ -59,7 +51,7 @@ func TestIntegrationSQLKVStorageBackend(t *testing.T) { backend, _ := NewTestSqlKvBackend(t, ctx, false) return backend }, &TestOptions{ - NSPrefix: "sqlkvstorage-test", + NSPrefix: "sqlkvstoragetest", SkipTests: skipTests, }) }) @@ -69,7 +61,7 @@ func TestIntegrationSQLKVStorageBackend(t *testing.T) { backend, _ := NewTestSqlKvBackend(t, ctx, true) return backend }, &TestOptions{ - NSPrefix: "sqlkvstorage-withrvmanager-test", + NSPrefix: "sqlkvstoragetest-rvmanager", SkipTests: skipTests, }) })