squakez commented on a change in pull request #2522: URL: https://github.com/apache/camel-k/pull/2522#discussion_r709174650
########## File path: e2e/support/test_support.go ########## @@ -1083,54 +1083,58 @@ func CreateTimerKamelet(ns string, name string) func() error { }, Spec: v1alpha1.KameletSpec{ Definition: &v1alpha1.JSONSchemaProps{ - Properties: map[string]v1alpha1.JSONSchemaProp{ - "message": { - Type: "string", - }, - }, + Properties: properties, }, - Flow: asFlow(map[string]interface{}{ - "from": map[string]interface{}{ - "uri": "timer:tick", - "steps": []map[string]interface{}{ - { - "set-body": map[string]interface{}{ - "constant": "{{message}}", - }, - }, - { - "to": "kamelet:sink", - }, - }, - }, - }), + Flow: asFlow(flow), }, } return TestClient().Create(TestContext, &kamelet) } } -func BindKameletTo(ns, name, from string, to corev1.ObjectReference, properties map[string]string) func() error { - return func() error { - kb := v1alpha1.KameletBinding{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: ns, - Name: name, - }, - Spec: v1alpha1.KameletBindingSpec{ - Source: v1alpha1.Endpoint{ - Ref: &corev1.ObjectReference{ - Kind: "Kamelet", - APIVersion: v1alpha1.SchemeGroupVersion.String(), - Name: from, +func CreateTimerKamelet(ns string, name string) func() error { + props := map[string]v1alpha1.JSONSchemaProp{ + "message": { + Type: "string", + }, + } + + flow := map[string]interface{}{ + "from": map[string]interface{}{ + "uri": "timer:tick", + "steps": []map[string]interface{}{ + { + "set-body": map[string]interface{}{ + "constant": "{{message}}", }, - Properties: asEndpointProperties(properties), }, - Sink: v1alpha1.Endpoint{ - Ref: &to, - Properties: asEndpointProperties(map[string]string{}), + { + "to": "kamelet:sink", }, }, + }, + } + + return CreateKamelet(ns, name, flow, props) +} + +func BindKameletTo(ns string, name string, from corev1.ObjectReference, to corev1.ObjectReference, sourceProperties map[string]string, sinkProperties map[string]string) func() error { + return BindKameletToWithErrorHandler(ns, name, from, to, sourceProperties, sinkProperties, map[string]interface{}{}) +} + +func BindKameletToWithErrorHandler(ns string, name string, from corev1.ObjectReference, to corev1.ObjectReference, sourceProperties map[string]string, sinkProperties map[string]string, errorHandler map[string]interface{}) func() error { + return func() error { + kb := v1alpha1.NewKameletBinding(ns, name) + kb.Spec = v1alpha1.KameletBindingSpec{ + Source: v1alpha1.Endpoint{ + Ref: &from, + Properties: asEndpointProperties(sourceProperties), + }, + Sink: v1alpha1.Endpoint{ + Ref: &to, + Properties: asEndpointProperties(sinkProperties), + }, + ErrorHandler: asErrorHandlerSpec(errorHandler), Review comment: I think this one should be optional. If you provide some meaningful configuration, then you can provide the `ErrorHandler` parameter, otherwise you must not. The error reported in the CI may be because of this configuration that likely is set to empty. -- 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