SQL/Blob: Add support for blob storage to SQL backend (#98192)

This commit is contained in:
Ryan McKinley
2025-01-08 23:08:10 +03:00
committed by GitHub
parent 3e68731600
commit 429da7fd68
18 changed files with 478 additions and 13 deletions
+51
View File
@@ -3,7 +3,9 @@ package sql
import (
"testing"
"text/template"
"time"
"github.com/grafana/grafana/pkg/apimachinery/utils"
"github.com/grafana/grafana/pkg/storage/unified/resource"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate/mocks"
)
@@ -266,5 +268,54 @@ func TestUnifiedStorageQueries(t *testing.T) {
},
},
},
sqlResourceBlobInsert: {
{
Name: "basic",
Data: &sqlResourceBlobInsertRequest{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Key: &resource.ResourceKey{
Namespace: "x",
Group: "g",
Resource: "r",
Name: "name",
},
Now: time.UnixMilli(1704056400000).UTC(),
Info: &utils.BlobInfo{
UID: "abc",
Hash: "xxx",
Size: 1234,
},
ContentType: "text/plain",
Value: []byte("abcdefg"),
},
},
},
sqlResourceBlobQuery: {
{
Name: "basic",
Data: &sqlResourceBlobQueryRequest{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Key: &resource.ResourceKey{
Namespace: "x",
Group: "g",
Resource: "r",
Name: "name",
},
UID: "abc",
},
},
{
Name: "resource", // NOTE: this returns multiple values
Data: &sqlResourceBlobQueryRequest{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Key: &resource.ResourceKey{
Namespace: "x",
Group: "g",
Resource: "r",
},
},
},
},
}})
}