|
|
@@ -94,10 +94,6 @@ var _ = Describe("ClusterExternalSecret controller", func() {
|
|
|
ExternalSecretName = "test-es"
|
|
|
ExternalSecretStore = "test-store"
|
|
|
ExternalSecretTargetSecretName = "test-secret"
|
|
|
- ClusterSecretStoreNamespace = "css-test-ns"
|
|
|
- FakeManager = "fake.manager"
|
|
|
- FooValue = "map-foo-value"
|
|
|
- BarValue = "map-bar-value"
|
|
|
)
|
|
|
|
|
|
var ExternalSecretNamespaceTargets = []testNamespace{
|
|
|
@@ -203,6 +199,17 @@ var _ = Describe("ClusterExternalSecret controller", func() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ syncWithESMetadata := func(tc *testCase) {
|
|
|
+ tc.clusterExternalSecret.Spec.ExternalSecretMetadata = esv1beta1.ExternalSecretMetadata{
|
|
|
+ Labels: map[string]string{"test-label-key1": "test-label-value1", "test-label-key2": "test-label-value2"},
|
|
|
+ Annotations: map[string]string{"test-annotation-key1": "test-annotation-value1", "test-annotation-key2": "test-annotation-value2"},
|
|
|
+ }
|
|
|
+ tc.checkExternalSecret = func(ces *esv1beta1.ClusterExternalSecret, es *esv1beta1.ExternalSecret) {
|
|
|
+ Expect(es.ObjectMeta.Labels).To(Equal(map[string]string{"test-label-key1": "test-label-value1", "test-label-key2": "test-label-value2"}))
|
|
|
+ Expect(es.ObjectMeta.Annotations).To(Equal(map[string]string{"test-annotation-key1": "test-annotation-value1", "test-annotation-key2": "test-annotation-value2"}))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
doNotOverwriteExistingES := func(tc *testCase) {
|
|
|
tc.preTest = func() {
|
|
|
es := &esv1beta1.ExternalSecret{
|
|
|
@@ -366,6 +373,7 @@ var _ = Describe("ClusterExternalSecret controller", func() {
|
|
|
},
|
|
|
|
|
|
Entry("Should use cluster external secret name if external secret name isn't defined", syncWithoutESName),
|
|
|
+ Entry("Should set external secret metadata if the field is set", syncWithESMetadata),
|
|
|
Entry("Should not overwrite existing external secrets and error out if one is present", doNotOverwriteExistingES),
|
|
|
Entry("Should have list of all provisioned namespaces", populatedProvisionedNamespaces),
|
|
|
Entry("Should delete external secrets when namespaces no longer match", deleteESInNonMatchingNS),
|