squakez commented on code in PR #6922: URL: https://github.com/apache/camel-k/pull/6922#discussion_r4625778614
########## e2e/keda/files/timer-to-ibmmq.yaml: ########## @@ -0,0 +1,60 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Integration +metadata: + name: timer-to-ibmmq +spec: + dependencies: + - camel:jms + - mvn:com.ibm.mq:com.ibm.mq.jakarta.client:9.4.0.26 + template: Review Comment: Ditto ########## e2e/keda/files/keda-it-ibmmq-to-log-auto.yaml: ########## @@ -0,0 +1,85 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Integration +metadata: + name: keda-it-ibmmq-to-log-auto +spec: + dependencies: + - camel:jms + - mvn:com.ibm.mq:com.ibm.mq.jakarta.client:9.4.0.26 + # KEDA reads the scale target's pod template to resolve scaler credentials. + # The Pod trait merges these Secret-backed variables into the Integration + # Deployment's "integration" container as well. + template: Review Comment: This one is deprecated. The regular `environment` trait is not good enough? we can also provide there configmap and secret. ########## e2e/keda/keda_ibmmq_test.go: ########## @@ -0,0 +1,111 @@ +//go:build integration +// +build integration + +/* +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. +*/ + +package keda + +import ( + "context" + "testing" + + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/v2/e2e/support" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" +) + +func TestIBMMQKedaAutoDiscoveryAndAutoscale(t *testing.T) { + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { + consumerName := "keda-it-ibmmq-to-log-auto" + producerName := "timer-to-ibmmq" + + ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/ibmmq-ephemeral.yaml", "-n", ns)) + ExpectExecSucceed(t, g, Kubectl("rollout", "status", "deployment/ibmmq", "-n", ns, "--timeout=300s")) + + ExpectExecSucceed(t, g, Kubectl( + "apply", "-f", + cloneAndReplaceNamespace(t, "files/keda-it-ibmmq-to-log-auto.yaml", ns), + "-n", ns, + )) + + g.Eventually( + IntegrationConditionStatus(t, ctx, ns, consumerName, v1.IntegrationConditionReady), + TestTimeoutLong, + ).Should(Equal(corev1.ConditionTrue)) + + g.Eventually(ScaledObject(t, ctx, ns, consumerName), TestTimeoutLong). + ShouldNot(BeNil()) + + ExpectExecSucceed(t, g, Kubectl( + "wait", "--for=condition=Ready", + "scaledobject/"+consumerName, "-n", ns, "--timeout=180s", + )) + ExpectExecSucceed(t, g, Kubectl( Review Comment: We don't care about this one, it is transparent to us and we must assume it works ootb. ########## e2e/keda/keda_ibmmq_test.go: ########## @@ -0,0 +1,111 @@ +//go:build integration +// +build integration + +/* +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. +*/ + +package keda + +import ( + "context" + "testing" + + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/v2/e2e/support" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" +) + +func TestIBMMQKedaAutoDiscoveryAndAutoscale(t *testing.T) { + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { + consumerName := "keda-it-ibmmq-to-log-auto" + producerName := "timer-to-ibmmq" + + ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/ibmmq-ephemeral.yaml", "-n", ns)) + ExpectExecSucceed(t, g, Kubectl("rollout", "status", "deployment/ibmmq", "-n", ns, "--timeout=300s")) + + ExpectExecSucceed(t, g, Kubectl( + "apply", "-f", + cloneAndReplaceNamespace(t, "files/keda-it-ibmmq-to-log-auto.yaml", ns), + "-n", ns, + )) + + g.Eventually( + IntegrationConditionStatus(t, ctx, ns, consumerName, v1.IntegrationConditionReady), + TestTimeoutLong, + ).Should(Equal(corev1.ConditionTrue)) + + g.Eventually(ScaledObject(t, ctx, ns, consumerName), TestTimeoutLong). + ShouldNot(BeNil()) + + ExpectExecSucceed(t, g, Kubectl( + "wait", "--for=condition=Ready", + "scaledobject/"+consumerName, "-n", ns, "--timeout=180s", + )) + ExpectExecSucceed(t, g, Kubectl( + "wait", "--for=condition=ScalingActive", + "hpa/keda-hpa-"+consumerName, "-n", ns, "--timeout=180s", + )) + + scaledObject := ScaledObject(t, ctx, ns, consumerName)() + g.Expect(scaledObject).NotTo(BeNil()) + g.Expect(scaledObject.Spec.Triggers).To(HaveLen(1)) Review Comment: I mean, all scaledobject configuration. ########## e2e/keda/keda_ibmmq_test.go: ########## @@ -0,0 +1,111 @@ +//go:build integration +// +build integration + +/* +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. +*/ + +package keda + +import ( + "context" + "testing" + + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" + corev1 "k8s.io/api/core/v1" + + . "github.com/apache/camel-k/v2/e2e/support" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" +) + +func TestIBMMQKedaAutoDiscoveryAndAutoscale(t *testing.T) { + WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { + consumerName := "keda-it-ibmmq-to-log-auto" + producerName := "timer-to-ibmmq" + + ExpectExecSucceed(t, g, Kubectl("apply", "-f", "files/ibmmq-ephemeral.yaml", "-n", ns)) + ExpectExecSucceed(t, g, Kubectl("rollout", "status", "deployment/ibmmq", "-n", ns, "--timeout=300s")) + + ExpectExecSucceed(t, g, Kubectl( + "apply", "-f", + cloneAndReplaceNamespace(t, "files/keda-it-ibmmq-to-log-auto.yaml", ns), + "-n", ns, + )) + + g.Eventually( + IntegrationConditionStatus(t, ctx, ns, consumerName, v1.IntegrationConditionReady), + TestTimeoutLong, + ).Should(Equal(corev1.ConditionTrue)) + + g.Eventually(ScaledObject(t, ctx, ns, consumerName), TestTimeoutLong). + ShouldNot(BeNil()) + + ExpectExecSucceed(t, g, Kubectl( + "wait", "--for=condition=Ready", + "scaledobject/"+consumerName, "-n", ns, "--timeout=180s", + )) + ExpectExecSucceed(t, g, Kubectl( + "wait", "--for=condition=ScalingActive", + "hpa/keda-hpa-"+consumerName, "-n", ns, "--timeout=180s", + )) + + scaledObject := ScaledObject(t, ctx, ns, consumerName)() + g.Expect(scaledObject).NotTo(BeNil()) + g.Expect(scaledObject.Spec.Triggers).To(HaveLen(1)) Review Comment: I think we can remove these, we expect them to work ootb. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
