Skip to content

Commit

Permalink
fix(e2e): Kamelets Default config as a labeled secret
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer authored and squakez committed Sep 27, 2023
1 parent 8a7f16f commit fdb2452
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
*/

import java.lang.Exception;
import java.lang.Override;
import org.apache.camel.builder.RouteBuilder;

public class TimerKameletIntegrationConfiguration09 extends RouteBuilder {
@Override
public void configure() throws Exception {
from("kamelet:iconfig09-timer-source")
.to("log:info");
}
}
54 changes: 25 additions & 29 deletions e2e/common/config/kamelet_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,41 +233,37 @@ func TestKameletImplicitConfigNamedMountedConfigmap(t *testing.T) {
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}

// Comenting test as it is failing on a non documented behavior.
// See https://github.com/apache/camel-k/issues/4750
/*
func TestKameletImplicitConfig(t *testing.T) {
func TestKameletImplicitConfigDefaultLabeledSecret(t *testing.T) {
RegisterTestingT(t)
t.Run("test custom timer source", func(t *testing.T) {
Expect(CreateTimerKamelet(ns, "iconfig-test-timer-source")()).To(Succeed())
t.Run("run test default config using labeled secret", func(t *testing.T) {
name := "iconfig-test-timer-source-int2"
secretName := "my-labeled-iconfig-test-timer-source-default-secret"
var secData = make(map[string]string)
secData["camel.kamelet.iconfig-test-timer-source.message"] = "very top secret message"
var labels = make(map[string]string)
labels["camel.apache.org/kamelet"] = "iconfig-test-timer-source"
Expect(CreatePlainTextSecretWithLabels(ns, secretName, secData, labels)).To(Succeed())
Eventually(SecretByName(ns, secretName), TestTimeoutLong).Should(Not(BeNil()))
Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration.java",
"-p", "camel.kamelet.iconfig-test-timer-source.message='Default message 02'",
"--name", name).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("very top secret message"))
Expect(Kamel("delete", name, "-n", ns).Execute()).To(Succeed())
Expect(DeleteSecret(ns, secretName)).To(Succeed())
})

t.Run("run test default config using labeled secret", func(t *testing.T) {

Expect(CreateTimerKamelet(ns, "iconfig09-timer-source")()).To(Succeed())

name := "iconfig-test-timer-source-int9"
secretName := "my-iconfig-int9-secret"

var secData = make(map[string]string)
secData["camel.kamelet.iconfig09-timer-source.message"] = "very top labeled secret message"
var labels = make(map[string]string)
labels["camel.apache.org/kamelet"] = "iconfig09-timer-source"
Expect(CreatePlainTextSecretWithLabels(ns, secretName, secData, labels)).To(Succeed())
Eventually(SecretByName(ns, secretName), TestTimeoutLong).Should(Not(BeNil()))

Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegrationConfiguration09.java",
"--name", name).Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationLogs(ns, name)).Should(ContainSubstring("very top labeled secret message"))

Expect(Kamel("delete", name, "-n", ns).Execute()).To(Succeed())
Eventually(Integration(ns, name), TestTimeoutLong).Should(BeNil())
Expect(DeleteSecret(ns, secretName)).To(Succeed())
Eventually(SecretByName(ns, secretName), TestTimeoutLong).Should(BeNil())
Expect(DeleteKamelet(ns, "iconfig09-timer-source")).To(Succeed())
})

Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Expect(DeleteKamelet(ns, "iconfig-test-timer-source")).To(Succeed())
}
*/

// Tests on integration with kamelets containing configuration from properties and secrets with parameters inside the integration.

Expand Down

0 comments on commit fdb2452

Please sign in to comment.