1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

common dockerjson config test

This commit is contained in:
Kian Kordtomeikel 2021-07-21 16:41:32 +01:00
parent 8827e3ab92
commit c1ed066c45
2 changed files with 46 additions and 0 deletions

View file

@ -228,3 +228,48 @@ func NestedJSONWithGJSON(f *framework.Framework) (string, func(*framework.TestCa
}
}
}
// This case creates a secret with a Docker json configuration value.
// The values from the nested data are extracted using gjson.
// not supported by: vault.
func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)) {
return "[specific] should do something I guess but not sure what!", func(tc *framework.TestCase) {
cloudSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, "docker-config-example")
cloudSecretValue := `{"auths":{"https://index.docker.io/v1/": {"auth": "c3R...zE2"}}}`
tc.Secrets = map[string]string{
cloudSecretName: cloudSecretValue,
}
tc.ExpectedSecret = &v1.Secret{
Type: v1.SecretTypeOpaque,
Data: map[string][]byte{
".dockerconfigjson": []byte(cloudSecretValue),
},
}
tc.ExternalSecret.Spec.Data = []esv1alpha1.ExternalSecretData{
{
SecretKey: "mysecret",
RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
Key: cloudSecretName,
},
},
}
tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
Metadata: esv1alpha1.ExternalSecretTemplateMetadata{
Annotations: map[string]string{
"example": "annotation",
},
Labels: map[string]string{
"example": "label",
},
},
Data: map[string]string{
".dockerconfigjson": "{{ .mysecret | toString }}",
},
}
}
}

View file

@ -36,5 +36,6 @@ var _ = Describe("[gcp] ", func() {
Entry(common.JSONDataFromSync(f)),
Entry(common.NestedJSONWithGJSON(f)),
Entry(common.JSONDataWithTemplate(f)),
Entry(common.DockerJSONConfig(f)),
)
})