You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "essobedo (via GitHub)" <gi...@apache.org> on 2023/03/23 11:23:59 UTC
[GitHub] [camel-k] essobedo commented on a diff in pull request #4153: fix(builder): native from source should rebuild
essobedo commented on code in PR #4153:
URL: https://github.com/apache/camel-k/pull/4153#discussion_r1146032181
##########
pkg/controller/integration/kits.go:
##########
@@ -250,3 +256,17 @@ func matchesTrait(it map[string]interface{}, kt map[string]interface{}) bool {
// perform exact match on the two trait maps
return reflect.DeepEqual(it, kt)
}
+
+func hasMatchingSources(it *v1.Integration, kit *v1.IntegrationKit) bool {
+ for _, itSource := range it.Sources() {
+ for _, ikSource := range kit.Spec.Sources {
+ if itSource.Content == ikSource.Content {
+ // found, let's move to the next one
+ break
+ }
+ return false
+ }
+
+ }
+ return true
Review Comment:
If the integration has more sources than the kit and it includes all the sources of the kit, this will run `true`, I'm not sure if it is expected, is-it?
##########
e2e/native/native_with_sources_test.go:
##########
@@ -54,9 +54,38 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Java Magicstring!"))
+ })
+
+ t.Run("java native same should not rebuild", func(t *testing.T) {
+ name := "java-native-clone"
+ Expect(KamelRunWithID(operatorID, ns, "files/Java.java", "--name", name,
+ "-t", "quarkus.package-type=native",
+ ).Execute()).To(Succeed())
+ // This one should run quickly as it suppose to reuse an IntegrationKit
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationPod(ns, name), TestTimeoutShort).
+ Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Java Magicstring!"))
+ Expect(IntegrationKit(ns, "java-native")).Should(Equal(IntegrationKit(ns, "java-native-clone")))
+ })
Review Comment:
Maybe this test should be included in the previous one as they are highly coupled, I mean if we launch only this test, it cannot pass.
##########
e2e/native/native_with_sources_test.go:
##########
@@ -54,9 +54,38 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Java Magicstring!"))
+ })
+
+ t.Run("java native same should not rebuild", func(t *testing.T) {
+ name := "java-native-clone"
+ Expect(KamelRunWithID(operatorID, ns, "files/Java.java", "--name", name,
+ "-t", "quarkus.package-type=native",
+ ).Execute()).To(Succeed())
+ // This one should run quickly as it suppose to reuse an IntegrationKit
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutShort).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationPod(ns, name), TestTimeoutShort).
+ Should(WithTransform(getContainerCommand(), MatchRegexp(".*camel-k-integration-\\d+\\.\\d+\\.\\d+[-A-Za-z]*-runner.*")))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).
+ Should(Equal(corev1.ConditionTrue))
Eventually(IntegrationLogs(ns, name), TestTimeoutShort).Should(ContainSubstring("Java Magicstring!"))
+ Expect(IntegrationKit(ns, "java-native")).Should(Equal(IntegrationKit(ns, "java-native-clone")))
+ })
+ t.Run("java native should rebuild", func(t *testing.T) {
+ name := "java-native-2"
Review Comment:
ditto
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org