-
Notifications
You must be signed in to change notification settings - Fork 630
Destination in Parallel and Sequence #2095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e85e7a8
b55b2cc
f0d6a3d
1f59d9f
221306f
4f3c21b
eb9b5a5
2010b59
b735820
58efd82
d50f086
5c4195d
885e1f8
e0a2a29
923bad3
ec1d0c7
13d7d72
ab327c6
3312b51
4cdd9b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,11 @@ import ( | |
| "testing" | ||
|
|
||
| "github.com/google/go-cmp/cmp" | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/runtime" | ||
| eventingduck "knative.dev/eventing/pkg/apis/duck/v1alpha1" | ||
| "knative.dev/pkg/apis" | ||
| "knative.dev/pkg/apis/v1alpha1" | ||
| ) | ||
|
|
||
| func TestParallelValidation(t *testing.T) { | ||
|
|
@@ -46,13 +46,13 @@ func TestParallelValidation(t *testing.T) { | |
| } | ||
|
|
||
| func TestParallelSpecValidation(t *testing.T) { | ||
| subscriberURI := "http://example.com" | ||
| subscriberURI := apis.HTTP("example.com") | ||
| validChannelTemplate := &eventingduck.ChannelTemplateSpec{ | ||
| metav1.TypeMeta{ | ||
| TypeMeta: metav1.TypeMeta{ | ||
| Kind: "mykind", | ||
| APIVersion: "myapiversion", | ||
| }, | ||
| &runtime.RawExtension{}, | ||
| Spec: &runtime.RawExtension{}, | ||
| } | ||
| tests := []struct { | ||
| name string | ||
|
|
@@ -77,7 +77,7 @@ func TestParallelSpecValidation(t *testing.T) { | |
| }, { | ||
| name: "missing channeltemplatespec", | ||
| ts: &ParallelSpec{ | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| fe := apis.ErrMissingField("channelTemplate") | ||
|
|
@@ -86,8 +86,10 @@ func TestParallelSpecValidation(t *testing.T) { | |
| }, { | ||
| name: "invalid channeltemplatespec missing APIVersion", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: &eventingduck.ChannelTemplateSpec{metav1.TypeMeta{Kind: "mykind"}, &runtime.RawExtension{}}, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| ChannelTemplate: &eventingduck.ChannelTemplateSpec{ | ||
| TypeMeta: metav1.TypeMeta{Kind: "mykind"}, | ||
| Spec: &runtime.RawExtension{}}, | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| fe := apis.ErrMissingField("channelTemplate.apiVersion") | ||
|
|
@@ -96,8 +98,10 @@ func TestParallelSpecValidation(t *testing.T) { | |
| }, { | ||
| name: "invalid channeltemplatespec missing Kind", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: &eventingduck.ChannelTemplateSpec{metav1.TypeMeta{APIVersion: "myapiversion"}, &runtime.RawExtension{}}, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| ChannelTemplate: &eventingduck.ChannelTemplateSpec{ | ||
| TypeMeta: metav1.TypeMeta{APIVersion: "myapiversion"}, | ||
| Spec: &runtime.RawExtension{}}, | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| fe := apis.ErrMissingField("channelTemplate.kind") | ||
|
|
@@ -107,7 +111,7 @@ func TestParallelSpecValidation(t *testing.T) { | |
| name: "valid parallel", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: validChannelTemplate, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| return nil | ||
|
|
@@ -116,7 +120,7 @@ func TestParallelSpecValidation(t *testing.T) { | |
| name: "valid parallel with valid reply", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: validChannelTemplate, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| Reply: makeValidReply("reply-channel"), | ||
| }, | ||
| want: func() *apis.FieldError { | ||
|
|
@@ -126,28 +130,29 @@ func TestParallelSpecValidation(t *testing.T) { | |
| name: "valid parallel with invalid missing name", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: validChannelTemplate, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| Reply: &corev1.ObjectReference{ | ||
| APIVersion: "messaging.knative.dev/v1alpha1", | ||
| Kind: "inmemorychannel", | ||
| Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| Reply: &v1alpha1.Destination{ | ||
| DeprecatedAPIVersion: "messaging.knative.dev/v1alpha1", | ||
| DeprecatedKind: "inmemorychannel", | ||
| }, | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| fe := apis.ErrMissingField("reply.name") | ||
| return fe | ||
| }(), | ||
| }, { | ||
| name: "valid parallel with invalid reply", | ||
| ts: &ParallelSpec{ | ||
| ChannelTemplate: validChannelTemplate, | ||
| Branches: []ParallelBranch{{Subscriber: SubscriberSpec{URI: &subscriberURI}}}, | ||
| Reply: makeInvalidReply("reply-channel"), | ||
| }, | ||
| want: func() *apis.FieldError { | ||
| fe := apis.ErrDisallowedFields("reply.Namespace") | ||
| fe.Details = "only name, apiVersion and kind are supported fields" | ||
| return fe | ||
| }(), | ||
| // TODO check if destination should support DeprecatedNamespace and in its Ref. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as in #2094 |
||
| //}, { | ||
| // name: "valid parallel with invalid reply", | ||
| // ts: &ParallelSpec{ | ||
| // ChannelTemplate: validChannelTemplate, | ||
| // Branches: []ParallelBranch{{Subscriber: v1alpha1.Destination{URI: subscriberURI}}}, | ||
| // Reply: makeInvalidReply("reply-channel"), | ||
| // }, | ||
| // want: func() *apis.FieldError { | ||
| // fe := apis.ErrDisallowedFields("reply.Namespace") | ||
| // fe.Details = "only name, apiVersion and kind are supported fields" | ||
| // return fe | ||
| // }(), | ||
| }} | ||
|
|
||
| for _, test := range tests { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SubscriberSpec has a *string as URI, as opposed to our Destination, which is *apis.URL. Check if this can break...