diff --git a/pkg/broker/filter/filter_handler_test.go b/pkg/broker/filter/filter_handler_test.go index b15f2fde3df..a1a290524ca 100644 --- a/pkg/broker/filter/filter_handler_test.go +++ b/pkg/broker/filter/filter_handler_test.go @@ -27,11 +27,12 @@ import ( "testing" "time" - "knative.dev/eventing/pkg/eventingtls" filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered" "knative.dev/pkg/configmap" "knative.dev/pkg/system" + "knative.dev/eventing/pkg/eventingtls" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" "knative.dev/eventing/pkg/reconciler/broker/resources" @@ -64,10 +65,11 @@ import ( eventpolicyinformerfake "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" subscriptioninformerfake "knative.dev/eventing/pkg/client/injection/informers/messaging/v1/subscription/fake" - // Fake injection client - _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" _ "knative.dev/pkg/client/injection/kube/client/fake" _ "knative.dev/pkg/client/injection/kube/informers/factory/filtered/fake" + + // Fake injection client + _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" ) const ( @@ -121,7 +123,7 @@ func TestReceiver(t *testing.T) { expectedStatus: http.StatusBadRequest, }, "Path too long": { - request: httptest.NewRequest(http.MethodPost, "/triggers/test-namespace/test-trigger/extra", nil), + request: httptest.NewRequest(http.MethodPost, "/triggers/test-namespace/test-trigger/uuid/extra/extra", nil), expectedStatus: http.StatusBadRequest, }, "Path without prefix": { @@ -130,7 +132,7 @@ func TestReceiver(t *testing.T) { }, "Trigger.Get fails": { // No trigger exists, so the Get will fail. - expectedStatus: http.StatusBadRequest, + expectedStatus: http.StatusNotFound, }, "Trigger doesn't have SubscriberURI": { triggers: []*eventingv1.Trigger{ diff --git a/pkg/broker/ingress/ingress_handler_test.go b/pkg/broker/ingress/ingress_handler_test.go index f30174c1476..0950302c807 100644 --- a/pkg/broker/ingress/ingress_handler_test.go +++ b/pkg/broker/ingress/ingress_handler_test.go @@ -26,11 +26,12 @@ import ( "testing" "time" - "knative.dev/eventing/pkg/eventingtls" filteredconfigmapinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/configmap/filtered/fake" filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered" "knative.dev/pkg/system" + "knative.dev/eventing/pkg/eventingtls" + "github.com/cloudevents/sdk-go/v2/client" "github.com/cloudevents/sdk-go/v2/event" cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" @@ -54,10 +55,11 @@ import ( brokerinformerfake "knative.dev/eventing/pkg/client/injection/informers/eventing/v1/broker/fake" eventpolicyinformerfake "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" - // Fake injection client - _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" _ "knative.dev/pkg/client/injection/kube/client/fake" _ "knative.dev/pkg/client/injection/kube/informers/factory/filtered/fake" + + // Fake injection client + _ "knative.dev/eventing/pkg/client/injection/informers/eventing/v1alpha1/eventpolicy/fake" ) const ( @@ -223,9 +225,9 @@ func TestHandler_ServeHTTP(t *testing.T) { method: nethttp.MethodPost, uri: "/ns/name", body: getValidEvent(), - statusCode: nethttp.StatusBadRequest, + statusCode: nethttp.StatusInternalServerError, handler: handler(), - reporter: &mockReporter{StatusCode: nethttp.StatusBadRequest, EventDispatchTimeReported: false}, + reporter: &mockReporter{StatusCode: nethttp.StatusInternalServerError, EventDispatchTimeReported: false}, defaulter: broker.TTLDefaulter(logger, 100), brokers: []*eventingv1.Broker{ withUninitializedAnnotations(makeBroker("name", "ns")),