This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 59f5bc7ce test: Add an E2E test for deploying an it using secret key 
filtering
59f5bc7ce is described below

commit 59f5bc7ce5a41ab930f1409a8bc827e14896341b
Author: Nicolas Filotto <nfilo...@talend.com>
AuthorDate: Mon Aug 29 17:14:37 2022 +0200

    test: Add an E2E test for deploying an it using secret key filtering
---
 e2e/global/common/config/config_test.go            | 15 +++++++++++++++
 .../config/files/config-secret-key-route.groovy    | 22 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/e2e/global/common/config/config_test.go 
b/e2e/global/common/config/config_test.go
index cda0c2990..9363fb391 100644
--- a/e2e/global/common/config/config_test.go
+++ b/e2e/global/common/config/config_test.go
@@ -140,6 +140,12 @@ func TestRunConfigExamples(t *testing.T) {
                secData["my-secret-key"] = "very top secret"
                CreatePlainTextSecret(ns, "my-sec", secData)
 
+               // Store a secret with multi values
+               var secDataMulti = make(map[string]string)
+               secDataMulti["my-secret-key"] = "very top secret"
+               secDataMulti["my-secret-key-2"] = "even more secret"
+               CreatePlainTextSecret(ns, "my-sec-multi", secDataMulti)
+
                t.Run("Config secret", func(t *testing.T) {
                        Expect(KamelRunWithID(operatorID, ns, 
"./files/config-secret-route.groovy", "--config", 
"secret:my-sec").Execute()).To(Succeed())
                        Eventually(IntegrationPodPhase(ns, 
"config-secret-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -167,6 +173,15 @@ func TestRunConfigExamples(t *testing.T) {
                        Eventually(AutogeneratedConfigmapsCount(ns), 
TestTimeoutShort).Should(Equal(0))
                })
 
+               t.Run("Secret with filtered key", func(t *testing.T) {
+                       Expect(KamelRunWithID(operatorID, ns, 
"./files/config-secret-key-route.groovy", "--config", 
"secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
+                       Eventually(IntegrationPodPhase(ns, 
"config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
+                       Eventually(IntegrationConditionStatus(ns, 
"config-secret-key-route", v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+                       Eventually(IntegrationLogs(ns, 
"config-secret-key-route"), 
TestTimeoutShort).ShouldNot(ContainSubstring(secDataMulti["my-secret-key"]))
+                       Eventually(IntegrationLogs(ns, 
"config-secret-key-route"), 
TestTimeoutShort).Should(ContainSubstring(secDataMulti["my-secret-key-2"]))
+                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+               })
+
                // Resource File
 
                t.Run("Plain text resource file", func(t *testing.T) {
diff --git a/e2e/global/common/config/files/config-secret-key-route.groovy 
b/e2e/global/common/config/files/config-secret-key-route.groovy
new file mode 100644
index 000000000..21919af65
--- /dev/null
+++ b/e2e/global/common/config/files/config-secret-key-route.groovy
@@ -0,0 +1,22 @@
+// camel-k: language=groovy
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ from('timer:secret')
+    .setBody()
+        .simple("resource:classpath:my-secret-key-2")
+    .log('secret content is: ${body}')

Reply via email to