You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/07/23 08:17:03 UTC
[GitHub] [camel-k] bouskaJ opened a new pull request #2522: [test] add Kamelet errorHandler test
bouskaJ opened a new pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522
<!-- Description -->
<!--
Enter your extended release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required". If no release note is required, write "NONE".
You can (optionally) mark this PR with labels "kind/bug" or "kind/feature" to make sure
the text is added to the right section of the release notes.
-->
**Release Note**
```release-note
NONE
```
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on a change in pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez commented on a change in pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#discussion_r675391485
##########
File path: e2e/support/test_support.go
##########
@@ -1110,6 +1110,79 @@ func CreateTimerKamelet(ns string, name string) func() error {
}
}
+func CreateLogKamelet(ns string, name string) func() error {
+ return func() error {
+ kamelet := v1alpha1.Kamelet{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: ns,
+ Name: name,
+ },
+ Spec: v1alpha1.KameletSpec{
+ Definition: &v1alpha1.JSONSchemaProps{
+ Properties: map[string]v1alpha1.JSONSchemaProp{
+ "loggerName": {
+ Type: "string",
+ },
+ },
+ },
+ Flow: asFlow(map[string]interface{}{
+ "from": map[string]interface{}{
+ "uri": "kamelet:source",
+ "steps": []map[string]interface{}{
+ {
+ "to": "log:{{loggerName}}",
+ },
+ },
+ },
+ }),
+ },
+ }
Review comment:
Excellent support method. Better to make it a general function such as `CreateKamelet()` and then you use it from another CreateLogKamelet() which is local to your test and is in charge to make a specific behavior.
##########
File path: e2e/support/test_support.go
##########
@@ -1110,6 +1110,79 @@ func CreateTimerKamelet(ns string, name string) func() error {
}
}
+func CreateLogKamelet(ns string, name string) func() error {
+ return func() error {
+ kamelet := v1alpha1.Kamelet{
+ ObjectMeta: metav1.ObjectMeta{
+ Namespace: ns,
+ Name: name,
+ },
+ Spec: v1alpha1.KameletSpec{
+ Definition: &v1alpha1.JSONSchemaProps{
+ Properties: map[string]v1alpha1.JSONSchemaProp{
+ "loggerName": {
+ Type: "string",
+ },
+ },
+ },
+ Flow: asFlow(map[string]interface{}{
+ "from": map[string]interface{}{
+ "uri": "kamelet:source",
+ "steps": []map[string]interface{}{
+ {
+ "to": "log:{{loggerName}}",
+ },
+ },
+ },
+ }),
+ },
+ }
+ return TestClient().Create(TestContext, &kamelet)
+ }
+}
+
+func CreateErrorProducerKamelet(ns string, name string) func() error {
Review comment:
As the other comment, you may have this local to your test extending the general `CreateKamelet` func
##########
File path: e2e/support/test_support.go
##########
@@ -1136,6 +1209,28 @@ func BindKameletTo(ns, name, from string, to corev1.ObjectReference, properties
}
}
+func BindKameletToWithErrorHandler(ns, name, from string, 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: &corev1.ObjectReference{
Review comment:
I'd use the same `corev1.ObjectReference` mechanics you're making with the `to` input parameters instead, leaving the declaration of the `from` to the caller. I think you took it the implementation from `BindKameletTo()` func. Check if you can create a func which is returning a general `KameletBinding` and the refactor those methods using it. Always good if we can simplify our code without adding duplicates.
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-885597396
Yeah, I bumped into that issue as well while working on something different. I am investigating and will report more details shortly.
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on a change in pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] mcada commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
mcada commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-904469025
#2564 is merged - can we proceed with the rebase?
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] bouskaJ commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
bouskaJ commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-885589169
@squakez, @astefanutti the CI fails with
```
logs:
Error: dump.go:142: integration
Error: dump.go:174: > at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:236)
Error: dump.go:174: > ... 31 more
Error: dump.go:174: >
Error: dump.go:174: > 2021-07-23 11:25:32,186 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: defaultErrorHandler of type: org.apache.camel.ErrorHandlerFactory
Error: dump.go:174: > at org.apache.camel.support.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:241)
Error: dump.go:174: > at org.apache.camel.model.errorhandler.ErrorHandlerHelper.lookupErrorHandlerFactory(ErrorHandlerHelper.java:82)
Error: dump.go:174: > at org.apache.camel.reifier.errorhandler.ErrorHandlerRefReifier.lookupErrorHandler(ErrorHandlerRefReifier.java:41)
Error: dump.go:174: > at org.apache.camel.reifier.errorhandler.ErrorHandlerRefReifier.createErrorHandler(ErrorHandlerRefReifier.java:35)
```
the generated KameletBinding is
```
spec:
errorHandler:
dead-letter-channel:
endpoint:
properties:
loggerName: kameletErrorHandler
ref:
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
name: my-own-log-sink
sink:
properties:
loggerName: integrationLogger
ref:
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
name: my-own-log-sink
source:
properties:
message: throw Error
ref:
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
name: my-own-error-producer-source
```
```
spec:
configuration:
- type: property
value: 'camel.beans.defaultErrorHandler = #class:org.apache.camel.builder.DeadLetterChannelBuilder'
- type: property
value: camel.beans.defaultErrorHandler.deadLetterUri = kamelet:my-own-log-sink/errorHandler
- type: property
value: camel.k.errorHandler.ref = defaultErrorHandler
- type: property
value: camel.kamelet.my-own-error-producer-source.source.message = throw Error
- type: property
value: camel.kamelet.my-own-log-sink.errorHandler.loggerName = kameletErrorHandler
- type: property
value: camel.kamelet.my-own-log-sink.sink.loggerName = integrationLogger
flows:
- from:
steps:
- to: kamelet:my-own-log-sink/sink
uri: kamelet:my-own-error-producer-source/source
profile: OpenShift
```
The most important message is that the test is working on `1.4.0`. Do you know what could be wrong?
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-904613683
> #2564 is merged - can we proceed with the rebase?
Yes please.
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-896102288
Let's wait to merge #2564 and we can rebase this.
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez merged pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez merged pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] squakez commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
squakez commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-885601879
Tracked here #2525
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-k] bouskaJ commented on pull request #2522: [test] add Kamelet errorHandler test
Posted by GitBox <gi...@apache.org>.
bouskaJ commented on pull request #2522:
URL: https://github.com/apache/camel-k/pull/2522#issuecomment-905451207
@squakez Two CI workflows failed but it seems that it's not my fault. Can you rerun them?
--
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-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org