You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/11/24 07:58:18 UTC
[camel-k] branch main updated: Fix #2638: fix condition for external kit and add test
This is an automated email from the ASF dual-hosted git repository.
astefanutti 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 44618f2 Fix #2638: fix condition for external kit and add test
44618f2 is described below
commit 44618f24704caa12afb57ac7b07b43fcc7a9e7b2
Author: nicolaferraro <ni...@gmail.com>
AuthorDate: Wed Nov 17 13:09:30 2021 +0100
Fix #2638: fix condition for external kit and add test
---
e2e/common/scale_integration_test.go | 21 +++++++++++++++++++++
pkg/trait/container.go | 4 ++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/e2e/common/scale_integration_test.go b/e2e/common/scale_integration_test.go
index 7863f9f..5c70901 100644
--- a/e2e/common/scale_integration_test.go
+++ b/e2e/common/scale_integration_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "fmt"
"testing"
. "github.com/onsi/gomega"
@@ -119,6 +120,26 @@ func TestIntegrationScale(t *testing.T) {
Should(gstruct.PointTo(BeNumerically("==", 1)))
})
+ t.Run("Scale integration with external image", func(t *testing.T) {
+ RegisterTestingT(t)
+
+ image := IntegrationPodImage(ns, name)()
+ Expect(image).NotTo(BeEmpty())
+ // Save resources by deleting the integration
+ Expect(Kamel("delete", name, "-n", ns).Execute()).To(Succeed())
+
+ Expect(Kamel("run", "-n", ns, "files/Java.java", "--name", "pre-built", "-t", fmt.Sprintf("container.image=%s", image)).Execute()).To(Succeed())
+ Eventually(IntegrationPhase(ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ Eventually(IntegrationPodPhase(ns, "pre-built"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ Expect(ScaleIntegration(ns, "pre-built", 0)).To(Succeed())
+ Eventually(IntegrationPod(ns, "pre-built"), TestTimeoutMedium).Should(BeNil())
+ Expect(ScaleIntegration(ns, "pre-built", 1)).To(Succeed())
+ Eventually(IntegrationPhase(ns, "pre-built"), TestTimeoutShort).Should(Equal(v1.IntegrationPhaseRunning))
+ Eventually(IntegrationPodPhase(ns, "pre-built"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+
+ Expect(Kamel("delete", "pre-built", "-n", ns).Execute()).To(Succeed())
+ })
+
// Clean up
RegisterTestingT(t)
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
diff --git a/pkg/trait/container.go b/pkg/trait/container.go
index a12b261..b0f5bf5 100644
--- a/pkg/trait/container.go
+++ b/pkg/trait/container.go
@@ -167,8 +167,8 @@ func isValidPullPolicy(policy corev1.PullPolicy) bool {
}
func (t *containerTrait) Apply(e *Environment) error {
- if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
- return t.configureImageIntegrationKit(e)
+ if err := t.configureImageIntegrationKit(e); err != nil {
+ return err
}
return t.configureContainer(e)
}