Skip to content

Commit

Permalink
Fix #2638: fix condition for external kit and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Nov 17, 2021
1 parent 87b3a94 commit 92c45b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions e2e/common/scale_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ limitations under the License.
package common

import (
"fmt"
"testing"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -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, name, 0)).To(Succeed())
Eventually(IntegrationPod(ns, "pre-built"), TestTimeoutMedium).Should(BeNil())
Expect(ScaleIntegration(ns, name, 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())
Expand Down
4 changes: 2 additions & 2 deletions pkg/trait/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 92c45b5

Please sign in to comment.