Repository: apache/camel-k
Pull request #4349 (2023-05-09 11:01:23)

fix(e2e): high memory native test
<!-- Description -->

Closes https://github.com/apache/camel-k/issues/4345


<!--
Enter your extended release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required". If no release note is required, write "NONE". 

You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
the text is added to the right section of the release notes. 
-->

**Release Note**
```release-note
fix(e2e): high memory native test
```



Patch:
diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index 862043d5c..b1f1623c4 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -258,6 +258,7 @@ func findOrCreateIntegrationPlatform(ctx context.Context, c client.Client, opera
 		if defaultPlatform.Labels == nil {
 			defaultPlatform.Labels = make(map[string]string)
 		}
+		defaultPlatform.Labels["app"] = "camel-k"
 		defaultPlatform.Labels["camel.apache.org/platform.generated"] = "true"
 
 		if operatorID != "" {
diff --git a/pkg/trait/platform.go b/pkg/trait/platform.go
index 8850c1fb5..88468889e 100644
--- a/pkg/trait/platform.go
+++ b/pkg/trait/platform.go
@@ -132,6 +132,7 @@ func (t *platformTrait) getOrCreatePlatform(e *Environment) (*v1.IntegrationPlat
 		if defaultPlatform.Labels == nil {
 			defaultPlatform.Labels = make(map[string]string)
 		}
+		defaultPlatform.Labels["app"] = "camel-k"
 		defaultPlatform.Labels["camel.apache.org/platform.generated"] = True
 		// Cascade the operator id in charge to reconcile the Integration
 		if v1.GetOperatorIDAnnotation(e.Integration) != "" {


Test patch:
diff --git a/e2e/native/files/Java2.java b/e2e/native/files/Java2.java
index 73b29ab99..8a3f7ad4a 100644
--- a/e2e/native/files/Java2.java
+++ b/e2e/native/files/Java2.java
@@ -17,7 +17,7 @@
 
  import org.apache.camel.builder.RouteBuilder;
 
- public class Java extends RouteBuilder {
+ public class Java2 extends RouteBuilder {
    @Override
    public void configure() throws Exception {
      from("timer:tick")
diff --git a/e2e/native/native_binding_test.go b/e2e/native/native_binding_test.go
index 1ac2f950f..8e6aca73a 100644
--- a/e2e/native/native_binding_test.go
+++ b/e2e/native/native_binding_test.go
@@ -23,12 +23,13 @@ limitations under the License.
 package native
 
 import (
-	"testing"
-
 	. "github.com/apache/camel-k/v2/e2e/support"
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	. "github.com/onsi/gomega"
 	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"testing"
+	"time"
 )
 
 func TestNativeBinding(t *testing.T) {
@@ -41,6 +42,19 @@ func TestNativeBinding(t *testing.T) {
 		).Execute()).To(Succeed())
 		Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
+		pl := Platform(ns)()
+		// set a longer timeout than default as for some reason the builder hit the timeout
+		pl.Spec.Build.BuildCatalogToolTimeout = &metav1.Duration{
+			Duration: 5 * time.Minute,
+		}
+		TestClient().Update(TestContext, pl)
+		Eventually(Platform(ns)).ShouldNot(BeNil())
+		Eventually(PlatformBuildCatalogToolTimeout(ns)).Should(Equal(
+			&metav1.Duration{
+				Duration: 5 * time.Minute,
+			},
+		))
+
 		from := corev1.ObjectReference{
 			Kind:       "Kamelet",
 			Name:       "timer-source",
diff --git a/e2e/native/native_with_sources_test.go b/e2e/native/native_with_sources_test.go
index b5128ab95..f5681d479 100644
--- a/e2e/native/native_with_sources_test.go
+++ b/e2e/native/native_with_sources_test.go
@@ -24,13 +24,14 @@ package native
 
 import (
 	"testing"
+	"time"
 
 	. "github.com/onsi/gomega"
 
-	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"
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
 func TestNativeHighMemoryIntegrations(t *testing.T) {
@@ -43,6 +44,19 @@ func TestNativeHighMemoryIntegrations(t *testing.T) {
 		).Execute()).To(Succeed())
 		Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
+		pl := Platform(ns)()
+		// set a longer timeout than default as for some reason the builder hit the timeout
+		pl.Spec.Build.BuildCatalogToolTimeout = &metav1.Duration{
+			Duration: 5 * time.Minute,
+		}
+		TestClient().Update(TestContext, pl)
+		Eventually(Platform(ns)).ShouldNot(BeNil())
+		Eventually(PlatformBuildCatalogToolTimeout(ns)).Should(Equal(
+			&metav1.Duration{
+				Duration: 5 * time.Minute,
+			},
+		))
+
 		t.Run("java native support", func(t *testing.T) {
 			name := "java-native"
 			Expect(KamelRunWithID(operatorID, ns, "files/Java.java", "--name", name,
diff --git a/pkg/trait/platform_test.go b/pkg/trait/platform_test.go
index d549c99d4..2907680a4 100644
--- a/pkg/trait/platform_test.go
+++ b/pkg/trait/platform_test.go
@@ -109,7 +109,7 @@ func TestPlatformTraitCreatesDefaultPlatform(t *testing.T) {
 	assert.Equal(t, v1.IntegrationPhaseWaitingForPlatform, e.Integration.Status.Phase)
 	assert.Equal(t, 1, len(e.Resources.Items()))
 	defPlatform := v1.NewIntegrationPlatform("ns1", platform.DefaultPlatformName)
-	defPlatform.Labels = map[string]string{"camel.apache.org/platform.generated": True}
+	defPlatform.Labels = map[string]string{"app": "camel-k", "camel.apache.org/platform.generated": True}
 	assert.Contains(t, e.Resources.Items(), &defPlatform)
 }