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 2022/12/12 08:50:13 UTC
[camel-k] branch main updated (f2b0207a3 -> 738d39ef0)
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
from f2b0207a3 Fix #3869: Update Saga Example
new e4cc09eee test: Add test for kamel bind command with step properties
new 738d39ef0 feat(cli): Update Kamel bind step index in properties to start at 1 instead of 0
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
pkg/cmd/bind.go | 5 +++--
pkg/cmd/bind_test.go | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
[camel-k] 02/02: feat(cli): Update Kamel bind step index in properties to start at 1 instead of 0
Posted by pc...@apache.org.
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 738d39ef06167c8f4657f2eb92586741bb1c9ea7
Author: Gaelle Fournier <ga...@gmail.com>
AuthorDate: Thu Dec 8 12:11:08 2022 +0100
feat(cli): Update Kamel bind step index in properties to start at 1 instead of 0
fix #2586
---
pkg/cmd/bind.go | 5 +++--
pkg/cmd/bind_test.go | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index a5d4a3826..06150e61f 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -56,7 +56,7 @@ func newCmdBind(rootCmdOptions *RootCmdOptions) (*cobra.Command, *bindCmdOptions
cmd.Flags().String("error-handler", "", `Add error handler (none|log|sink:<endpoint>). Sink endpoints are expected in the format "[[apigroup/]version:]kind:[namespace/]name", plain Camel URIs or Kamelet name.`)
cmd.Flags().String("name", "", "Name for the binding")
cmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml")
- cmd.Flags().StringArrayP("property", "p", nil, `Add a binding property in the form of "source.<key>=<value>", "sink.<key>=<value>", "error-handler.<key>=<value>" or "step-<n>.<key>=<value>"`)
+ cmd.Flags().StringArrayP("property", "p", nil, `Add a binding property in the form of "source.<key>=<value>", "sink.<key>=<value>", "error-handler.<key>=<value>" or "step-<n>.<key>=<value> where <n> is the step order starting from 1"`)
cmd.Flags().Bool("skip-checks", false, "Do not verify the binding for compliance with Kamelets and other Kubernetes resources")
cmd.Flags().StringArray("step", nil, `Add binding steps as Kubernetes resources. Endpoints are expected in the format "[[apigroup/]version:]kind:[namespace/]name", plain Camel URIs or Kamelet name.`)
cmd.Flags().StringArrayP("trait", "t", nil, `Add a trait to the corresponding Integration.`)
@@ -210,7 +210,8 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args []string) error {
if len(o.Steps) > 0 {
binding.Spec.Steps = make([]v1alpha1.Endpoint, 0)
for idx, stepDesc := range o.Steps {
- stepKey := fmt.Sprintf("%s%d", stepKeyPrefix, idx)
+ stepIndex := idx + 1
+ stepKey := fmt.Sprintf("%s%d", stepKeyPrefix, stepIndex)
step, err := o.decode(stepDesc, stepKey)
if err != nil {
return err
diff --git a/pkg/cmd/bind_test.go b/pkg/cmd/bind_test.go
index 9d263b784..a2729784a 100644
--- a/pkg/cmd/bind_test.go
+++ b/pkg/cmd/bind_test.go
@@ -206,8 +206,8 @@ func TestBindSteps(t *testing.T) {
buildCmdOptions, bindCmd, _ := initializeBindCmdOptions(t)
output, err := test.ExecuteCommand(bindCmd, cmdBind, "my:src", "my:dst", "-o", "yaml",
"--step", "dst:step1", "--step", "src:step2",
- "-p", "step-0.var1=my-step1-var1", "-p", "step-0.var2=my-step1-var2",
- "-p", "step-1.var1=my-step2-var1", "-p", "step-1.var2=my-step2-var2")
+ "-p", "step-1.var1=my-step1-var1", "-p", "step-1.var2=my-step1-var2",
+ "-p", "step-2.var1=my-step2-var1", "-p", "step-2.var2=my-step2-var2")
assert.Equal(t, "yaml", buildCmdOptions.OutputFormat)
assert.Nil(t, err)
[camel-k] 01/02: test: Add test for kamel bind command with step properties
Posted by pc...@apache.org.
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 e4cc09eeeaf71c3f32c5ef811519c326d6e53f58
Author: Gaelle Fournier <ga...@gmail.com>
AuthorDate: Thu Dec 8 10:53:39 2022 +0100
test: Add test for kamel bind command with step properties
Refs: #2586
---
pkg/cmd/bind_test.go | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/pkg/cmd/bind_test.go b/pkg/cmd/bind_test.go
index e4583b7bd..9d263b784 100644
--- a/pkg/cmd/bind_test.go
+++ b/pkg/cmd/bind_test.go
@@ -201,3 +201,37 @@ spec:
status: {}
`, output)
}
+
+func TestBindSteps(t *testing.T) {
+ buildCmdOptions, bindCmd, _ := initializeBindCmdOptions(t)
+ output, err := test.ExecuteCommand(bindCmd, cmdBind, "my:src", "my:dst", "-o", "yaml",
+ "--step", "dst:step1", "--step", "src:step2",
+ "-p", "step-0.var1=my-step1-var1", "-p", "step-0.var2=my-step1-var2",
+ "-p", "step-1.var1=my-step2-var1", "-p", "step-1.var2=my-step2-var2")
+ assert.Equal(t, "yaml", buildCmdOptions.OutputFormat)
+
+ assert.Nil(t, err)
+ assert.Equal(t, `apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+ annotations:
+ camel.apache.org/operator.id: camel-k
+ creationTimestamp: null
+ name: my-to-my
+spec:
+ sink:
+ uri: my:dst
+ source:
+ uri: my:src
+ steps:
+ - properties:
+ var1: my-step1-var1
+ var2: my-step1-var2
+ uri: dst:step1
+ - properties:
+ var1: my-step2-var1
+ var2: my-step2-var2
+ uri: src:step2
+status: {}
+`, output)
+}