Skip to content

Commit

Permalink
Remove obsoleted code for subscribable interface (#602)
Browse files Browse the repository at this point in the history
* Remove duplicate code

Signed-off-by: Galo Navarro <[email protected]>

* fixup! Remove duplicate code
  • Loading branch information
srvaroa authored and knative-prow-robot committed Nov 10, 2018
1 parent 1182e06 commit 8fcf54f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bazel-*
.idea/
.vscode/
.DS_Store
*.swp
25 changes: 0 additions & 25 deletions pkg/apis/eventing/v1alpha1/subscribable_channelable_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,6 @@ func isValidChannel(f corev1.ObjectReference) *apis.FieldError {
return errs
}

func isSubscribableEmpty(f corev1.ObjectReference) bool {
return equality.Semantic.DeepEqual(f, corev1.ObjectReference{})
}

// Valid from only contains the following fields:
// - Kind == 'Channel'
// - APIVersion == 'eventing.knative.dev/v1alpha1'
// - Name == not empty
func isValidSubscribable(f corev1.ObjectReference) *apis.FieldError {
errs := isValidObjectReference(f)

if f.Kind != "Channel" {
fe := apis.ErrInvalidValue(f.Kind, "kind")
fe.Paths = []string{"kind"}
fe.Details = "only 'Channel' kind is allowed"
errs = errs.Also(fe)
}
if f.APIVersion != "eventing.knative.dev/v1alpha1" {
fe := apis.ErrInvalidValue(f.APIVersion, "apiVersion")
fe.Details = "only eventing.knative.dev/v1alpha1 is allowed for apiVersion"
errs = errs.Also(fe)
}
return errs
}

func isValidObjectReference(f corev1.ObjectReference) *apis.FieldError {
return checkRequiredObjectReferenceFields(f).
Also(checkDisallowedObjectReferenceFields(f))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ func TestIsValidChannel(t *testing.T) {
})
}
}
func TestIsValidSubscribable(t *testing.T) {
for _, test := range validationTests {
t.Run(test.name, func(t *testing.T) {
got := isValidSubscribable(test.ref)
if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" {
t.Errorf("%s: validation (-want, +got) = %v", test.name, diff)
}
})
}
}

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

0 comments on commit 8fcf54f

Please sign in to comment.