mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 07:22:09 +08:00

* 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>
64 lines
1.4 KiB
Go
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",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|