tadayosi commented on code in PR #3599:
URL: https://github.com/apache/camel-k/pull/3599#discussion_r963520625


##########
e2e/namespace/install/cli/config_test.go:
##########
@@ -0,0 +1,67 @@
+//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 common
+
+import (
+       "os"
+       "strings"
+       "testing"
+
+       corev1 "k8s.io/api/core/v1"
+
+       . "github.com/onsi/gomega"
+       "github.com/stretchr/testify/assert"
+
+       . "github.com/apache/camel-k/e2e/support"
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       "github.com/apache/camel-k/pkg/cmd"
+)
+
+func TestKamelCLIConfig(t *testing.T) {
+       WithNewTestNamespace(t, func(ns string) {
+               operatorID := "camel-k-cli-config"
+               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+
+               t.Run("check default namespace", func(t *testing.T) {
+                       _, err := os.Stat(cmd.DefaultConfigLocation)
+                       assert.True(t, os.IsNotExist(err), "No file at 
"+cmd.DefaultConfigLocation+" was expected")
+                       t.Cleanup(func() { os.Remove(cmd.DefaultConfigLocation) 
})
+                       Expect(Kamel("config", "--default-namespace", 
ns).Execute()).To(Succeed())
+
+                       Expect(Kamel("run", 
"files/yaml.yaml").Execute()).To(Succeed())
+                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))

Review Comment:
   Instead of doing assertions differently you can just do the same assertions 
to test if an integration is really running, e.g.:
   
https://github.com/apache/camel-k/blob/main/e2e/namespace/install/cli/run_test.go#L48-L51



##########
e2e/namespace/install/cli/config_test.go:
##########
@@ -0,0 +1,67 @@
+//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 common
+
+import (
+       "os"
+       "strings"
+       "testing"
+
+       corev1 "k8s.io/api/core/v1"
+
+       . "github.com/onsi/gomega"
+       "github.com/stretchr/testify/assert"
+
+       . "github.com/apache/camel-k/e2e/support"
+       v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+       "github.com/apache/camel-k/pkg/cmd"
+)
+
+func TestKamelCLIConfig(t *testing.T) {
+       WithNewTestNamespace(t, func(ns string) {
+               operatorID := "camel-k-cli-config"
+               Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+
+               t.Run("check default namespace", func(t *testing.T) {
+                       _, err := os.Stat(cmd.DefaultConfigLocation)
+                       assert.True(t, os.IsNotExist(err), "No file at 
"+cmd.DefaultConfigLocation+" was expected")
+                       t.Cleanup(func() { os.Remove(cmd.DefaultConfigLocation) 
})
+                       Expect(Kamel("config", "--default-namespace", 
ns).Execute()).To(Succeed())
+
+                       Expect(Kamel("run", 
"files/yaml.yaml").Execute()).To(Succeed())

Review Comment:
   You should specify the operator ID along with `kamel run`, i.e:
   ```
   kamel run --operator-id camel-k-cli-config files/yaml.yaml
   ```



-- 
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