This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit ad5831aecdedd0f6d9a5878d67846ef9af361477
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Jun 3 11:28:47 2021 +0200

    chore(e2e): run option with destination path
    
    Ref #2003
---
 docs/modules/ROOT/pages/cli/modeline.adoc             |  2 +-
 e2e/common/config/config_test.go                      | 19 +++++++++++++++++++
 ...roovy => resource-configmap-location-route.groovy} |  2 +-
 ...te.groovy => resource-configmap-route copy.groovy} |  0
 ...ute.groovy => resource-file-location-route.groovy} |  2 +-
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/docs/modules/ROOT/pages/cli/modeline.adoc 
b/docs/modules/ROOT/pages/cli/modeline.adoc
index 01437c2..424a00b 100644
--- a/docs/modules/ROOT/pages/cli/modeline.adoc
+++ b/docs/modules/ROOT/pages/cli/modeline.adoc
@@ -94,7 +94,7 @@ The following is a partial list of useful options:
 |Add a runtime property or properties file (syntax: 
_[my-key=my-value\|file:/path/to/my-conf.properties]_)
 
 |resource
-|Add a runtime resource from a Configmap, a Secret or a file (syntax: 
_[configmap\|secret\|file]:name)_
+|Add a runtime resource from a Configmap, a Secret or a file (syntax: 
_[configmap\|secret\|file]:name[@path])_
 
 |trait
 |Configure a trait, e.g. `trait=service.enabled=false`
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index e2d16d4..9282fad 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -82,6 +82,16 @@ func TestRunConfigExamples(t *testing.T) {
                        Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
                })
 
+               t.Run("Resource configmap with destination", func(t *testing.T) 
{
+                       // We can reuse the configmap created previously
+
+                       Expect(Kamel("run", "-n", ns, 
"./files/resource-configmap-location-route.groovy", "--resource", 
"configmap:my-cm@/tmp/app").Execute()).To(Succeed())
+                       Eventually(IntegrationPodPhase(ns, 
"resource-configmap-location-route"), 
TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationCondition(ns, 
"resource-configmap-location-route", camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+                       Eventually(IntegrationLogs(ns, 
"resource-configmap-location-route"), 
TestTimeoutShort).Should(ContainSubstring(cmData["my-configmap-key"]))
+                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+               })
+
                // Secret
 
                // Store a secret on the cluster
@@ -125,6 +135,14 @@ func TestRunConfigExamples(t *testing.T) {
                        Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
                })
 
+               t.Run("Plain text resource file with destination path", func(t 
*testing.T) {
+                       Expect(Kamel("run", "-n", 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"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationCondition(ns, 
"resource-file-location-route", camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+                       Eventually(IntegrationLogs(ns, 
"resource-file-location-route"), TestTimeoutShort).Should(ContainSubstring("the 
file body"))
+                       Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+               })
+
                t.Run("Binary (zip) resource file", func(t *testing.T) {
                        Expect(Kamel("run", "-n", 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"), TestTimeoutMedium).Should(Equal(v1.PodRunning))
@@ -176,5 +194,6 @@ func TestRunConfigExamples(t *testing.T) {
                        Eventually(IntegrationLogs(ns, 
"build-property-file-route"), 
TestTimeoutShort).Should(ContainSubstring("my-super-application"))
                        Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
                })
+
        })
 }
diff --git a/e2e/common/config/files/resource-configmap-route.groovy 
b/e2e/common/config/files/resource-configmap-location-route.groovy
similarity index 89%
copy from e2e/common/config/files/resource-configmap-route.groovy
copy to e2e/common/config/files/resource-configmap-location-route.groovy
index 3df9e05..08c2f9c 100644
--- a/e2e/common/config/files/resource-configmap-route.groovy
+++ b/e2e/common/config/files/resource-configmap-location-route.groovy
@@ -16,5 +16,5 @@
  * limitations under the License.
  */
 
-from('file:/etc/camel/data/configmaps/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false')
+from('file:/tmp/app/?fileName=my-configmap-key&noop=true&idempotent=false')
     .log('resource file content is: ${body}')
diff --git a/e2e/common/config/files/resource-configmap-route.groovy 
b/e2e/common/config/files/resource-configmap-route copy.groovy
similarity index 100%
copy from e2e/common/config/files/resource-configmap-route.groovy
copy to e2e/common/config/files/resource-configmap-route copy.groovy
diff --git a/e2e/common/config/files/resource-configmap-route.groovy 
b/e2e/common/config/files/resource-file-location-route.groovy
similarity index 89%
rename from e2e/common/config/files/resource-configmap-route.groovy
rename to e2e/common/config/files/resource-file-location-route.groovy
index 3df9e05..076a2a9 100644
--- a/e2e/common/config/files/resource-configmap-route.groovy
+++ b/e2e/common/config/files/resource-file-location-route.groovy
@@ -16,5 +16,5 @@
  * limitations under the License.
  */
 
-from('file:/etc/camel/data/configmaps/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false')
+from('file:/tmp/?fileName=file.txt&noop=true&idempotent=false')
     .log('resource file content is: ${body}')

Reply via email to