Browse Source

SSH Key common sync test, JSON Parsing error with vault.

Kian Kordtomeikel 4 years ago
parent
commit
686cad9234
4 changed files with 40 additions and 0 deletions
  1. 1 0
      e2e/suite/aws/secretsmanager.go
  2. 1 0
      e2e/suite/azure/azure.go
  3. 37 0
      e2e/suite/common/common.go
  4. 1 0
      e2e/suite/gcp/gcp.go

+ 1 - 0
e2e/suite/aws/secretsmanager.go

@@ -122,5 +122,6 @@ var _ = Describe("[aws] ", func() {
 		Entry(common.JSONDataWithTemplate(f)),
 		Entry(common.JSONDataWithTemplate(f)),
 		Entry("should sync secrets with jwt auth", jwt),
 		Entry("should sync secrets with jwt auth", jwt),
 		Entry(common.DockerJSONConfig(f)),
 		Entry(common.DockerJSONConfig(f)),
+		Entry(common.SSHKeySync(f)),
 	)
 	)
 })
 })

+ 1 - 0
e2e/suite/azure/azure.go

@@ -41,5 +41,6 @@ var _ = Describe("[azure] ", func() {
 		Entry(common.JSONDataWithProperty(f)),
 		Entry(common.JSONDataWithProperty(f)),
 		Entry(common.JSONDataWithTemplate(f)),
 		Entry(common.JSONDataWithTemplate(f)),
 		Entry(common.DockerJSONConfig(f)),
 		Entry(common.DockerJSONConfig(f)),
+		Entry(common.SSHKeySync(f)),
 	)
 	)
 })
 })

+ 37 - 0
e2e/suite/common/common.go

@@ -264,3 +264,40 @@ func DockerJSONConfig(f *framework.Framework) (string, func(*framework.TestCase)
 		}
 		}
 	}
 	}
 }
 }
+
+// This case adds an ssh private key secret and sybcs it.
+// CHECK THIS not supported by: vault. Json parsing error.
+func SSHKeySync(f *framework.Framework) (string, func(*framework.TestCase)) {
+	return "[common] should sync docker configurated json secrets with template", func(tc *framework.TestCase) {
+		sshSecretName := fmt.Sprintf("%s-%s", f.Namespace.Name, "ssh-priv-key-example")
+		sshSecretValue := `EY2NNWddRADTFdNvEojrCwo+DUxy6va2JltQAbxmhyvSZsL1eYsutunsKEwonGSru0Zd+m
+		z5DHJOOQdHEsH3AAAACmFub3RoZXJvbmU=
+		-----END OPENSSH PRIVATE KEY-----`
+
+		tc.Secrets = map[string]string{
+			sshSecretName: sshSecretValue,
+		}
+
+		tc.ExpectedSecret = &v1.Secret{
+			Type: v1.SecretTypeOpaque,
+			Data: map[string][]byte{
+				"ssh-privatekey": []byte(sshSecretValue),
+			},
+		}
+
+		tc.ExternalSecret.Spec.Data = []esv1alpha1.ExternalSecretData{
+			{
+				SecretKey: "mysecret",
+				RemoteRef: esv1alpha1.ExternalSecretDataRemoteRef{
+					Key: sshSecretName,
+				},
+			},
+		}
+
+		tc.ExternalSecret.Spec.Target.Template = &esv1alpha1.ExternalSecretTemplate{
+			Data: map[string]string{
+				"ssh-privatekey": "{{ .mysecret | toString }}",
+			},
+		}
+	}
+}

+ 1 - 0
e2e/suite/gcp/gcp.go

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