squakez commented on code in PR #5183:
URL: https://github.com/apache/camel-k/pull/5183#discussion_r1507307962


##########
e2e/common/traits/logging_test.go:
##########
@@ -0,0 +1,72 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> 
Vendoring & Build Tags -> Custom Tags" and add "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 traits
+
+import (
+       "testing"
+
+       . "github.com/apache/camel-k/v2/e2e/support"
+       . "github.com/onsi/gomega"
+       corev1 "k8s.io/api/core/v1"
+       "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+)
+
+func TestLoggingCategory(t *testing.T) {
+       RegisterTestingT(t)
+
+       operatorID := "camel-k"
+
+       t.Run("Test debug log evel", func(t *testing.T) {
+               name := RandomizedSuffixName("java")
+               Expect(KamelRunWithID(operatorID, ns, "files/Java.java", 
"--name", name, "-t", 
"logging.category.'org.apache.camel.impl'=DEBUG").Execute()).To(Succeed())
+               Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+
+               Eventually(UnstructuredIntegration(ns, name)).ShouldNot(BeNil())
+               unstructuredIntegration := UnstructuredIntegration(ns, name)()
+               logTrait, _, _ := 
unstructured.NestedMap(unstructuredIntegration.Object, "spec", "traits", 
"logging", "category")
+               Expect(logTrait).ToNot(BeNil())
+               Expect(len(logTrait)).To(Equal(1))
+               Expect(logTrait["org.apache.camel.impl"]).To(Equal("DEBUG"))

Review Comment:
   This check is more suitable of a unit test, like it already exists. E2E test 
should check that the configuration is applied correctly, ie, checking Pod's 
env variables and above all, checking the log traces exposed have that DEBUG 
level.
   As an example, see how we check for content in this test: 
https://github.com/apache/camel-k/blob/b86a7fb72ff5bedbc2a96b9c40fb40a693aa3b9b/e2e/common/languages/java_test.go#L43



-- 
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-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to