Skip to content

Commit 8fcf54f

Browse files
srvaroaknative-prow-robot
authored andcommitted
Remove obsoleted code for subscribable interface (#602)
* Remove duplicate code Signed-off-by: Galo Navarro <[email protected]> * fixup! Remove duplicate code
1 parent 1182e06 commit 8fcf54f

File tree

3 files changed

+1
-35
lines changed

3 files changed

+1
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ bazel-*
33
.idea/
44
.vscode/
55
.DS_Store
6+
*.swp

pkg/apis/eventing/v1alpha1/subscribable_channelable_validation.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,6 @@ func isValidChannel(f corev1.ObjectReference) *apis.FieldError {
5050
return errs
5151
}
5252

53-
func isSubscribableEmpty(f corev1.ObjectReference) bool {
54-
return equality.Semantic.DeepEqual(f, corev1.ObjectReference{})
55-
}
56-
57-
// Valid from only contains the following fields:
58-
// - Kind == 'Channel'
59-
// - APIVersion == 'eventing.knative.dev/v1alpha1'
60-
// - Name == not empty
61-
func isValidSubscribable(f corev1.ObjectReference) *apis.FieldError {
62-
errs := isValidObjectReference(f)
63-
64-
if f.Kind != "Channel" {
65-
fe := apis.ErrInvalidValue(f.Kind, "kind")
66-
fe.Paths = []string{"kind"}
67-
fe.Details = "only 'Channel' kind is allowed"
68-
errs = errs.Also(fe)
69-
}
70-
if f.APIVersion != "eventing.knative.dev/v1alpha1" {
71-
fe := apis.ErrInvalidValue(f.APIVersion, "apiVersion")
72-
fe.Details = "only eventing.knative.dev/v1alpha1 is allowed for apiVersion"
73-
errs = errs.Also(fe)
74-
}
75-
return errs
76-
}
77-
7853
func isValidObjectReference(f corev1.ObjectReference) *apis.FieldError {
7954
return checkRequiredObjectReferenceFields(f).
8055
Also(checkDisallowedObjectReferenceFields(f))

pkg/apis/eventing/v1alpha1/subscribable_channelable_validation_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,6 @@ func TestIsValidChannel(t *testing.T) {
9898
})
9999
}
100100
}
101-
func TestIsValidSubscribable(t *testing.T) {
102-
for _, test := range validationTests {
103-
t.Run(test.name, func(t *testing.T) {
104-
got := isValidSubscribable(test.ref)
105-
if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" {
106-
t.Errorf("%s: validation (-want, +got) = %v", test.name, diff)
107-
}
108-
})
109-
}
110-
}
111101

112102
func TestIsValidObjectReference(t *testing.T) {
113103
tests := []struct {

0 commit comments

Comments
 (0)