You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/05/10 10:19:09 UTC
[camel-k] 02/05: chore: remove file references
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 45d8bbd7b85a310eb97bbc6a991a788f16585f43
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu May 4 10:47:04 2023 +0200
chore: remove file references
---
e2e/common/cli/dev_mode_test.go | 53 ---------------
e2e/common/config/config_test.go | 68 -------------------
e2e/common/languages/groovy_test.go | 4 --
e2e/common/languages/init_test_support.go | 57 ----------------
e2e/common/languages/java_test.go | 11 ----
e2e/common/languages/js_test.go | 4 --
e2e/common/languages/kotlin_test.go | 4 --
e2e/common/languages/xml_test.go | 4 --
e2e/common/languages/yaml_test.go | 4 --
e2e/common/misc/kamelet_test.go | 77 +++++++++++++++++++++-
.../misc/{kamelet_binding_test.go => pipe_test.go} | 0
..._with_image_test.go => pipe_with_image_test.go} | 0
e2e/common/traits/health_test.go | 12 ++--
e2e/common/traits/openapi_test.go | 24 -------
e2e/knative/openapi_test.go | 10 ++-
pkg/cmd/install.go | 5 +-
pkg/cmd/modeline_test.go | 62 -----------------
pkg/cmd/run.go | 12 ++--
pkg/cmd/run_support.go | 2 +-
pkg/cmd/run_test.go | 6 +-
20 files changed, 100 insertions(+), 319 deletions(-)
diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go
index 05596e16e..cc6518769 100644
--- a/e2e/common/cli/dev_mode_test.go
+++ b/e2e/common/cli/dev_mode_test.go
@@ -24,16 +24,12 @@ package cli
import (
"context"
- "fmt"
"io"
- "io/ioutil"
"os"
- "path/filepath"
"testing"
"time"
. "github.com/onsi/gomega"
- "github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
. "github.com/apache/camel-k/v2/e2e/support"
@@ -117,55 +113,6 @@ func TestRunDevMode(t *testing.T) {
Eventually(logScanner.IsFound("Magicstring!"), TestTimeoutMedium).Should(BeTrue())
})
- t.Run("Dev mode resource file generated configmap", func(t *testing.T) {
- var tmpFile *os.File
- var err error
- if tmpFile, err = ioutil.TempFile("", "camel-k-"); err != nil {
- t.Error(err)
- }
- assert.Nil(t, tmpFile.Close())
- assert.Nil(t, ioutil.WriteFile(tmpFile.Name(), []byte("Hello from test!"), 0o644))
-
- RegisterTestingT(t)
- ctx, cancel := context.WithCancel(TestContext)
- defer cancel()
- piper, pipew := io.Pipe()
- defer pipew.Close()
- defer piper.Close()
-
- file := util.MakeTempCopy(t, "files/resource-file-location-route.groovy")
-
- kamelRun := KamelRunWithContext(ctx, operatorID, ns, file, "--dev", "--resource", fmt.Sprintf("file:%s@/tmp/file.txt", filepath.ToSlash(tmpFile.Name())))
- kamelRun.SetOut(pipew)
-
- logScanner := util.NewLogScanner(ctx, piper, `integration "resource-file-location-route" in phase Running`,
- "Hello from test!", "Goodbye from test!")
-
- args := os.Args
- defer func() { os.Args = args }()
-
- globalTest := os.Getenv("CAMEL_K_FORCE_GLOBAL_TEST") == "true"
- if globalTest {
- os.Args = []string{"kamel", "run", "-n", ns, file, "--dev", "--resource", fmt.Sprintf("file:%s@/tmp/file.txt", tmpFile.Name())}
- } else {
- os.Args = []string{"kamel", "run", "-n", ns, "--operator-id", operatorID, file, "--dev", "--resource", fmt.Sprintf("file:%s@/tmp/file.txt", filepath.ToSlash(tmpFile.Name()))}
- }
-
- go kamelRun.Execute()
-
- Eventually(logScanner.IsFound(`integration "resource-file-location-route" in phase Running`), TestTimeoutMedium).Should(BeTrue())
- Eventually(logScanner.IsFound("Hello from test!"), TestTimeoutMedium).Should(BeTrue())
- Expect(logScanner.IsFound("Goodbye from test!")()).To(BeFalse())
-
- // cool, now let's change the file to confirm the sync take place
- assert.Nil(t, ioutil.WriteFile(tmpFile.Name(), []byte("Goodbye from test!"), 0o644))
- Eventually(logScanner.IsFound("Goodbye from test!"), TestTimeoutMedium).Should(BeTrue())
-
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- // When the integration is deleted, then, also the autogenerated configmaps must be cleaned
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
// This test makes sure that `kamel run --dev` runs in seconds after initial build is
// already done for the same integration.
t.Run("dev mode rebuild in seconds", func(t *testing.T) {
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index f3362b343..73ccd0006 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -23,17 +23,14 @@ limitations under the License.
package config
import (
- "io/ioutil"
"testing"
. "github.com/onsi/gomega"
- "github.com/stretchr/testify/assert"
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"
- "github.com/apache/camel-k/v2/pkg/util/gzip"
)
func TestRunConfigExamples(t *testing.T) {
@@ -192,17 +189,6 @@ func TestRunConfigExamples(t *testing.T) {
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
- // Config File
-
- t.Run("Plain text configuration file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/config-file-route.groovy", "--config", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "config-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "config-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "config-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
t.Run("Secret with filtered key", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "./files/config-secret-key-route.groovy", "--config", "secret:my-sec-multi/my-secret-key-2").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "config-secret-key-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
@@ -212,60 +198,6 @@ func TestRunConfigExamples(t *testing.T) {
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
- // Resource File
-
- t.Run("Plain text resource file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
- t.Run("Plain text resource file with destination path", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-location-route.groovy", "--resource", "file:./files/resources-data.txt@/tmp/file.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-location-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-location-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
- t.Run("Binary (zip) resource file", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-binary-route.groovy", "--resource", "file:./files/resources-data.zip", "-d", "camel:zipfile").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-binary-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-binary-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-binary-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
- t.Run("Base64 compressed binary resource file", func(t *testing.T) {
- // We calculate the expected content
- source, err := ioutil.ReadFile("./files/resources-data.txt")
- assert.Nil(t, err)
- expectedBytes, err := gzip.CompressBase64([]byte(source))
- assert.Nil(t, err)
-
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-base64-encoded-route.groovy", "--resource", "file:./files/resources-data.txt", "--compression=true").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-base64-encoded-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-base64-encoded-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-base64-encoded-route"), TestTimeoutShort).Should(ContainSubstring(string(expectedBytes)))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
- t.Run("Plain text resource file with same content", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "./files/resource-file-route.groovy", "--resource", "file:./files/resources-data.txt",
- "--resource", "file:./files/resources-data-same.txt").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "resource-file-route"), TestTimeoutLong).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "resource-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "resource-file-route"), TestTimeoutShort).Should(ContainSubstring("the file body"))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Eventually(AutogeneratedConfigmapsCount(ns), TestTimeoutShort).Should(Equal(0))
- })
-
// Build-Properties
t.Run("Build time property", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "./files/build-property-route.groovy", "--build-property", "quarkus.application.name=my-super-application").Execute()).To(Succeed())
diff --git a/e2e/common/languages/groovy_test.go b/e2e/common/languages/groovy_test.go
index 8e76130ec..253081bef 100644
--- a/e2e/common/languages/groovy_test.go
+++ b/e2e/common/languages/groovy_test.go
@@ -43,9 +43,5 @@ func TestRunSimpleGroovyExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("init run groovy", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageGroovy)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/languages/init_test_support.go b/e2e/common/languages/init_test_support.go
deleted file mode 100644
index c33042bcf..000000000
--- a/e2e/common/languages/init_test_support.go
+++ /dev/null
@@ -1,57 +0,0 @@
-//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 languages
-
-import (
- "fmt"
- "path"
- "testing"
-
- . "github.com/onsi/gomega"
-
- v1 "k8s.io/api/core/v1"
-
- . "github.com/apache/camel-k/v2/e2e/support"
- "github.com/apache/camel-k/v2/e2e/support/util"
- camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-)
-
-func RunInitGeneratedExample(t *testing.T, operatorId, ns string, lang camelv1.Language) {
- dir := util.MakeTempDir(t)
- itName := fmt.Sprintf("init%s", string(lang)) // e.g. initjava
- fileName := fmt.Sprintf("%s.%s", itName, string(lang)) // e.g. initjava.java
- file := path.Join(dir, fileName)
- Expect(Kamel("init", file).Execute()).To(Succeed())
- Expect(KamelRunWithID(operatorId, ns, file).Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, itName), TestTimeoutLong).Should(Equal(v1.PodRunning))
- Eventually(IntegrationLogs(ns, itName), TestTimeoutShort).Should(ContainSubstring(languageInitExpectedString(lang)))
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
-}
-
-func languageInitExpectedString(lang camelv1.Language) string {
- langDesc := string(lang)
- if lang == camelv1.LanguageKotlin {
- langDesc = "kotlin"
- }
- return fmt.Sprintf(" Hello Camel K from %s", langDesc)
-}
diff --git a/e2e/common/languages/java_test.go b/e2e/common/languages/java_test.go
index 7de69a98f..903fd083b 100644
--- a/e2e/common/languages/java_test.go
+++ b/e2e/common/languages/java_test.go
@@ -43,16 +43,5 @@ func TestRunSimpleJavaExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("run java with properties", func(t *testing.T) {
- Expect(KamelRunWithID(operatorID, ns, "files/Prop.java", "--property", "file:files/prop.properties").Execute()).To(Succeed())
- Eventually(IntegrationPodPhase(ns, "prop"), TestTimeoutLong).Should(Equal(v1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "prop", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "prop"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
- })
-
- t.Run("init run java", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageJavaSource)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/languages/js_test.go b/e2e/common/languages/js_test.go
index da5f814bc..8bf0c4295 100644
--- a/e2e/common/languages/js_test.go
+++ b/e2e/common/languages/js_test.go
@@ -43,9 +43,5 @@ func TestRunSimpleJavaScriptExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "js"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("init run JavaScript", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageJavaScript)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/languages/kotlin_test.go b/e2e/common/languages/kotlin_test.go
index 770183860..da210afc2 100644
--- a/e2e/common/languages/kotlin_test.go
+++ b/e2e/common/languages/kotlin_test.go
@@ -43,9 +43,5 @@ func TestRunSimpleKotlinExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "kotlin"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("init run Kotlin", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageKotlin)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/languages/xml_test.go b/e2e/common/languages/xml_test.go
index 5b5181ce8..1ea6f8dd5 100644
--- a/e2e/common/languages/xml_test.go
+++ b/e2e/common/languages/xml_test.go
@@ -43,9 +43,5 @@ func TestRunSimpleXmlExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "xml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("init run xml", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageXML)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/languages/yaml_test.go b/e2e/common/languages/yaml_test.go
index 8aafc1cac..7e3dba1a4 100644
--- a/e2e/common/languages/yaml_test.go
+++ b/e2e/common/languages/yaml_test.go
@@ -43,9 +43,5 @@ func TestRunSimpleYamlExamples(t *testing.T) {
Eventually(IntegrationLogs(ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
})
- t.Run("init run yaml", func(t *testing.T) {
- RunInitGeneratedExample(t, operatorID, ns, camelv1.LanguageYaml)
- })
-
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
}
diff --git a/e2e/common/misc/kamelet_test.go b/e2e/common/misc/kamelet_test.go
index 23a5ac716..e54efd19c 100644
--- a/e2e/common/misc/kamelet_test.go
+++ b/e2e/common/misc/kamelet_test.go
@@ -34,10 +34,85 @@ import (
func TestKameletClasspathLoading(t *testing.T) {
RegisterTestingT(t)
+ // Store a configmap on the cluster
+ var cmData = make(map[string]string)
+ cmData["my-kamelet"] = `
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: my-timer-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Preview"
+ camel.apache.org/catalog.version: "0.3.0"
+ camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm9 [...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Timer"
+ labels:
+ camel.apache.org/kamelet.type: source
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: Timer Source
+ description: Produces periodic events with a custom payload.
+ required:
+ - message
+ type: object
+ properties:
+ period:
+ title: Period
+ description: The interval between two events in milliseconds
+ type: integer
+ default: 1000
+ message:
+ title: Message
+ description: The message to generate
+ type: string
+ example: hello world
+ contentType:
+ title: Content Type
+ description: The content type of the message being generated
+ type: string
+ default: text/plain
+ dependencies:
+ - "camel:core"
+ - "camel:timer"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: timer:tick
+ parameters:
+ period: "{{period}}"
+ steps:
+ - set-body:
+ constant: "{{message}}"
+ - set-header:
+ name: "Content-Type"
+ constant: "{{contentType}}"
+ - to: kamelet:sink
+ `
+ CreatePlainTextConfigmap(ns, "my-kamelet-cm", cmData)
+
// Basic
t.Run("test basic case", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, "files/TimerKameletIntegration.java", "-t", "kamelets.enabled=false",
- "--resource", "file:files/my-timer-source.kamelet.yaml@/kamelets/my-timer-source.kamelet.yaml",
+ "--resource", "configmap:my-kamelet-cm@/kamelets/my-timer-source.kamelet.yaml",
"-p camel.component.kamelet.location=file:/kamelets",
"-d", "camel:yaml-dsl",
// kamelet dependencies
diff --git a/e2e/common/misc/kamelet_binding_test.go b/e2e/common/misc/pipe_test.go
similarity index 100%
rename from e2e/common/misc/kamelet_binding_test.go
rename to e2e/common/misc/pipe_test.go
diff --git a/e2e/common/misc/kamelet_binding_with_image_test.go b/e2e/common/misc/pipe_with_image_test.go
similarity index 100%
rename from e2e/common/misc/kamelet_binding_with_image_test.go
rename to e2e/common/misc/pipe_with_image_test.go
diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go
index fb73eab88..2da0d25cf 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -138,22 +138,18 @@ func TestHealthTrait(t *testing.T) {
t.Run("Readiness condition with stopped binding", func(t *testing.T) {
name := "stopped-binding"
- // Clean up any previous kamelet with same name
- Expect(TestClient().Delete(TestContext, Kamelet("my-own-timer-source", ns)())).To(Succeed())
- Expect(TestClient().Delete(TestContext, Kamelet("my-own-log-sink", ns)())).To(Succeed())
-
- Expect(CreateTimerKamelet(ns, "my-own-timer-source")()).To(Succeed())
- Expect(CreateLogKamelet(ns, "my-own-log-sink")()).To(Succeed())
+ Expect(CreateTimerKamelet(ns, "my-own-timer-source")).To(Succeed())
+ Expect(CreateLogKamelet(ns, "my-own-log-sink")).To(Succeed())
from := corev1.ObjectReference{
Kind: "Kamelet",
- Name: "my-own-timer-source",
+ Name: "my-stopped-binding-timer-source",
APIVersion: camelv1.SchemeGroupVersion.String(),
}
to := corev1.ObjectReference{
Kind: "Kamelet",
- Name: "my-own-log-sink",
+ Name: "my-stopped-binding-log-sink",
APIVersion: camelv1.SchemeGroupVersion.String(),
}
diff --git a/e2e/common/traits/openapi_test.go b/e2e/common/traits/openapi_test.go
index 849f4b845..6a371a40b 100644
--- a/e2e/common/traits/openapi_test.go
+++ b/e2e/common/traits/openapi_test.go
@@ -37,30 +37,6 @@ import (
func TestOpenAPI(t *testing.T) {
RegisterTestingT(t)
- Expect(KamelRunWithID(operatorID, ns,
- "--name", "petstore",
- "--open-api", "file:files/openapi/petstore-api.yaml",
- "files/openapi/petstore.groovy",
- ).Execute()).To(Succeed())
-
- Eventually(IntegrationPodPhase(ns, "petstore"), TestTimeoutLong).
- Should(Equal(corev1.PodRunning))
- Eventually(Deployment(ns, "petstore"), TestTimeoutLong).
- Should(Not(BeNil()))
-
- Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
- Should(ContainSubstring("Started listPets (rest://get:/v1:/pets)"))
- Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
- Should(ContainSubstring("Started createPets (rest://post:/v1:/pets)"))
- Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
- Should(ContainSubstring("Started showPetById (rest://get:/v1:/pets/%7BpetId%7D)"))
-
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
-}
-
-func TestOpenAPIConfigmap(t *testing.T) {
- RegisterTestingT(t)
-
openapiContent, err := ioutil.ReadFile("./files/openapi/petstore-api.yaml")
assert.Nil(t, err)
var cmDataProps = make(map[string]string)
diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go
index f9ddb0de8..d26bba889 100644
--- a/e2e/knative/openapi_test.go
+++ b/e2e/knative/openapi_test.go
@@ -27,14 +27,22 @@ import (
. "github.com/apache/camel-k/v2/e2e/support"
. "github.com/onsi/gomega"
+ "github.com/stretchr/testify/assert"
+ "io/ioutil"
)
func TestOpenAPIService(t *testing.T) {
RegisterTestingT(t)
+ openapiContent, err := ioutil.ReadFile("./files/petstore-api.yaml")
+ assert.Nil(t, err)
+ var cmDataProps = make(map[string]string)
+ cmDataProps["petstore-api.yaml"] = string(openapiContent)
+ CreatePlainTextConfigmap(ns, "my-openapi-knative", cmDataProps)
+
Expect(KamelRunWithID(operatorID, ns,
"--name", "petstore",
- "--open-api", "file:files/petstore-api.yaml",
+ "--open-api", "configmap:my-openapi-knative",
"files/petstore.groovy",
).Execute()).To(Succeed())
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 26fbcffa3..ba9d76b02 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -355,7 +355,7 @@ func (o *installCmdOptions) installOperator(cmd *cobra.Command, output *kubernet
}
// Set up IntegrationPlatform
- platform, err := o.setupIntegrationPlatform(cmd, c, namespace, platformName, registrySecretName, output)
+ platform, err := o.setupIntegrationPlatform(c, namespace, platformName, registrySecretName, output)
if err != nil {
return err
}
@@ -464,8 +464,7 @@ func (o *installCmdOptions) setupRegistrySecret(c client.Client, namespace strin
return "", nil
}
-func (o *installCmdOptions) setupIntegrationPlatform(
- cmd *cobra.Command, c client.Client, namespace string, platformName string, registrySecretName string,
+func (o *installCmdOptions) setupIntegrationPlatform(c client.Client, namespace string, platformName string, registrySecretName string,
output *kubernetes.Collection,
) (*v1.IntegrationPlatform, error) {
platform, err := install.NewPlatform(o.Context, c, o.ClusterType, o.SkipRegistrySetup, o.registry, platformName)
diff --git a/pkg/cmd/modeline_test.go b/pkg/cmd/modeline_test.go
index 3b5e6855c..fa3bd91dd 100644
--- a/pkg/cmd/modeline_test.go
+++ b/pkg/cmd/modeline_test.go
@@ -354,37 +354,6 @@ func TestModelineRunConfigSecret(t *testing.T) {
assert.NoError(t, err)
}
-func TestModelineRunConfigFile(t *testing.T) {
- err := util.WithTempDir("camel-k-test-", func(dir string) error {
- subDir := filepath.Join(dir, "sub")
- err := os.Mkdir(subDir, 0o700)
- assert.NoError(t, err)
-
- file := `
- // camel-k: config=file:application.properties
- `
- fileName := filepath.Join(subDir, "simple.groovy")
- err = os.WriteFile(fileName, []byte(file), 0o400)
- assert.NoError(t, err)
-
- propFile := `
- a=b
- `
- propFileName := filepath.Join(subDir, "application.properties")
- err = os.WriteFile(propFileName, []byte(propFile), 0o400)
- assert.NoError(t, err)
-
- cmd, flags, err := NewKamelWithModelineCommand(context.TODO(), []string{"kamel", "run", fileName})
- assert.NoError(t, err)
- assert.NotNil(t, cmd)
- assert.Equal(t, []string{"run", fileName, fmt.Sprintf("--config=file:%s", propFileName)}, flags)
-
- return nil
- })
-
- assert.NoError(t, err)
-}
-
func TestModelineRunResourceConfigmap(t *testing.T) {
err := util.WithTempDir("camel-k-test-", func(dir string) error {
subDir := filepath.Join(dir, "sub")
@@ -433,37 +402,6 @@ func TestModelineRunResourceSecret(t *testing.T) {
assert.NoError(t, err)
}
-func TestModelineRunResourceFile(t *testing.T) {
- err := util.WithTempDir("camel-k-test-", func(dir string) error {
- subDir := filepath.Join(dir, "sub")
- err := os.Mkdir(subDir, 0o700)
- assert.NoError(t, err)
-
- file := `
- // camel-k: resource=file:application.properties
- `
- fileName := filepath.Join(subDir, "simple.groovy")
- err = os.WriteFile(fileName, []byte(file), 0o400)
- assert.NoError(t, err)
-
- propFile := `
- a=b
- `
- propFileName := filepath.Join(subDir, "application.properties")
- err = os.WriteFile(propFileName, []byte(propFile), 0o400)
- assert.NoError(t, err)
-
- cmd, flags, err := NewKamelWithModelineCommand(context.TODO(), []string{"kamel", "run", fileName})
- assert.NoError(t, err)
- assert.NotNil(t, cmd)
- assert.Equal(t, []string{"run", fileName, fmt.Sprintf("--resource=file:%s", propFileName)}, flags)
-
- return nil
- })
-
- assert.NoError(t, err)
-}
-
func TestModelineQuotedPodTemplate(t *testing.T) {
err := util.WithTempDir("camel-k-test-", func(dir string) error {
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index 740682488..87f7edc9c 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -102,8 +102,8 @@ func newCmdRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *runCmdOptions)
cmd.Flags().StringP("kit", "k", "", "The kit used to run the integration")
cmd.Flags().StringArrayP("property", "p", nil, "Add a runtime property or properties file from a path, a config map or a secret (syntax: [my-key=my-value|file:/path/to/my-conf.properties|[configmap|secret]:name])")
cmd.Flags().StringArray("build-property", nil, "Add a build time property or properties file from a path, a config map or a secret (syntax: [my-key=my-value|file:/path/to/my-conf.properties|[configmap|secret]:name]])")
- cmd.Flags().StringArray("config", nil, "Add a runtime configuration from a Configmap, a Secret or a file (syntax: [configmap|secret|file]:name[/key], where name represents the local file path or the configmap/secret name and key optionally represents the configmap/secret key to be filtered)")
- cmd.Flags().StringArray("resource", nil, "Add a runtime resource from a Configmap, a Secret or a file (syntax: [configmap|secret|file]:name[/key][@path], where name represents the local file path or the configmap/secret name, key optionally represents the configmap/secret key to be filtered and path represents the destination path)")
+ cmd.Flags().StringArray("config", nil, "Add a runtime configuration from a Configmap or a Secret (syntax: [configmap|secret]:name[/key], where name represents the configmap/secret name and key optionally represents the configmap/secret key to be filtered)")
+ cmd.Flags().StringArray("resource", nil, "Add a runtime resource from a Configmap or a Secret (syntax: [configmap|secret]:name[/key][@path], where name represents the configmap/secret name, key optionally represents the configmap/secret key to be filtered and path represents the destination path)")
cmd.Flags().StringArray("maven-repository", nil, "Add a maven repository")
cmd.Flags().Bool("logs", false, "Print integration logs")
cmd.Flags().Bool("sync", false, "Synchronize the local source file with the cluster, republishing at each change")
@@ -286,9 +286,9 @@ func (o *runCmdOptions) validate() error {
}
for _, openapi := range o.OpenAPIs {
- // We support only local file and cluster configmaps
- if !(strings.HasPrefix(openapi, "file:") || strings.HasPrefix(openapi, "configmap:")) {
- return fmt.Errorf(`invalid openapi specification "%s". It supports only file or configmap`, openapi)
+ // We support only cluster configmaps
+ if !(strings.HasPrefix(openapi, "configmap:")) {
+ return fmt.Errorf(`invalid openapi specification "%s". It supports only configmaps`, openapi)
}
}
@@ -743,7 +743,7 @@ func (o *runCmdOptions) parseAndConvertToTrait(cmd *cobra.Command,
return err
}
// We try to autogenerate a configmap
- if _, err := parseConfigAndGenCm(o.Context, cmd, c, config, integration, o.Compression); err != nil {
+ if _, err := parseConfigAndGenCm(o.Context, cmd, c, config, integration); err != nil {
return err
}
o.Traits = append(o.Traits, convertToTrait(convert(config), traitParam))
diff --git a/pkg/cmd/run_support.go b/pkg/cmd/run_support.go
index ee7ffb163..b3fde6146 100644
--- a/pkg/cmd/run_support.go
+++ b/pkg/cmd/run_support.go
@@ -48,7 +48,7 @@ func addDependency(cmd *cobra.Command, it *v1.Integration, dependency string, ca
it.Spec.AddDependency(normalized)
}
-func parseConfigAndGenCm(ctx context.Context, cmd *cobra.Command, c client.Client, config *resource.Config, integration *v1.Integration, enableCompression bool) (*corev1.ConfigMap, error) {
+func parseConfigAndGenCm(ctx context.Context, cmd *cobra.Command, c client.Client, config *resource.Config, integration *v1.Integration) (*corev1.ConfigMap, error) {
switch config.StorageType() {
case resource.StorageTypeConfigmap:
cm := kubernetes.LookupConfigmap(ctx, c, integration.Namespace, config.Name())
diff --git a/pkg/cmd/run_test.go b/pkg/cmd/run_test.go
index 219b2f7a2..1efbfd112 100644
--- a/pkg/cmd/run_test.go
+++ b/pkg/cmd/run_test.go
@@ -229,13 +229,11 @@ func TestRunNameFlag(t *testing.T) {
func TestRunOpenApiFlag(t *testing.T) {
runCmdOptions, rootCmd, _ := initializeRunCmdOptions(t)
_, err := test.ExecuteCommand(rootCmd, cmdRun,
- "--open-api", "file:oapi1",
"--open-api", "configmap:oapi2",
integrationSource)
assert.Nil(t, err)
- assert.Len(t, runCmdOptions.OpenAPIs, 2)
- assert.Equal(t, "file:oapi1", runCmdOptions.OpenAPIs[0])
- assert.Equal(t, "configmap:oapi2", runCmdOptions.OpenAPIs[1])
+ assert.Len(t, runCmdOptions.OpenAPIs, 1)
+ assert.Equal(t, "configmap:oapi2", runCmdOptions.OpenAPIs[0])
}
func TestRunOpenApiInvalidFlag(t *testing.T) {