mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 15:02:33 +08:00
Plugins: Refactor kvstore usage in signing keys and angular patterns (#73154)
* Initial refactoring work for plugins kvstore * Replace implementations for keystore and angularstore * Cleanup * add interface check * lint * fix storeKeyGetter not being called in namespacedstore set * Fix tests * Comments * Add tests * Fix invalid cap in ListKeys when store is empty * Update docstrings * Add setLastUpdatedOnDelete * Renamed DefaultStoreKeyGetterFunc, add TestDefaultStoreKeyGetter * Sort imports * PR review: removed last_updated key * PR review: Removed setLastUpdatedOnDelete * Re-added relevant tests * PR review: Removed SingleKeyStore * PR review: Removed custom marshaling support * Renamed marshaler.go to marshal.go * PR review: removed unused interfaces * PR review: Moved marshal into namespacedstore.go * PR review: removed storekeygetter * Removed unused file cachekvstore.go * Renamed NamespacedStore to CacheKvStore * removed todo
This commit is contained in:
@ -41,7 +41,8 @@ func TestAngularPatternsStore(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("latest update", func(t *testing.T) {
|
||||
svc := ProvideService(kvstore.NewFakeKVStore())
|
||||
underlyingKv := kvstore.NewFakeKVStore()
|
||||
svc := ProvideService(underlyingKv)
|
||||
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
lastUpdated, err := svc.GetLastUpdated(context.Background())
|
||||
@ -59,7 +60,7 @@ func TestAngularPatternsStore(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("invalid timestamp stored", func(t *testing.T) {
|
||||
err := svc.(*KVStoreService).kv.Set(context.Background(), keyLastUpdated, "abcd")
|
||||
err := underlyingKv.Set(context.Background(), 0, kvNamespace, "last_updated", "abcd")
|
||||
require.NoError(t, err)
|
||||
|
||||
lastUpdated, err := svc.GetLastUpdated(context.Background())
|
||||
|
Reference in New Issue
Block a user