Files
Dana Axinte c22b4845bb SecretsManager: Add encrypted value store (#106607)
* SecretsManager: add encrypted value store

Co-authored-by: Dana Axinte <53751979+dana-axinte@users.noreply.github.com>
Co-authored-by: Leandro Deveikis <leandro.deveikis@gmail.com>
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>

* SecretsManager: wiring of encrypted value store

---------

Co-authored-by: Leandro Deveikis <leandro.deveikis@gmail.com>
Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
Co-authored-by: PoorlyDefinedBehaviour <brunotj2015@hotmail.com>
2025-06-12 11:52:01 +01:00

64 lines
1.4 KiB
Go

package encryption
import (
"testing"
"text/template"
"github.com/grafana/grafana/pkg/storage/unified/sql/sqltemplate/mocks"
)
func TestEncryptedValueQueries(t *testing.T) {
mocks.CheckQuerySnapshots(t, mocks.TemplateTestSetup{
RootDir: "testdata",
Templates: map[*template.Template][]mocks.TemplateTestCase{
sqlEncryptedValueCreate: {
{
Name: "create",
Data: &createEncryptedValue{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Row: &EncryptedValue{
Namespace: "ns",
UID: "abc123",
EncryptedData: []byte("secret"),
Created: 1234,
Updated: 5678,
},
},
},
},
sqlEncryptedValueRead: {
{
Name: "read",
Data: &readEncryptedValue{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Namespace: "ns",
UID: "abc123",
},
},
},
sqlEncryptedValueUpdate: {
{
Name: "update",
Data: &updateEncryptedValue{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Namespace: "ns",
UID: "abc123",
EncryptedData: []byte("secret"),
Updated: 5679,
},
},
},
sqlEncryptedValueDelete: {
{
Name: "delete",
Data: &deleteEncryptedValue{
SQLTemplate: mocks.NewTestingSQLTemplate(),
Namespace: "ns",
UID: "abc123",
},
},
},
},
})
}