Skip to content

Commit

Permalink
Add OPTIONS e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson committed Jun 23, 2021
1 parent 5697ba4 commit 40924fd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/conformance/helpers/broker_data_plane_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func BrokerDataPlaneNamespaceSetupOption(ctx context.Context, namespace string)
//Supports structured or Binary mode
//Respond with 2xx on good CE
//Respond with 400 on bad CE
//Reject non-POST requests to publish URI
//Reject non-POST, non-OPTIONS requests to publish URI (beyond spec?!)
func BrokerIngressDataPlaneTestHelper(
ctx context.Context,
t *testing.T,
Expand All @@ -108,6 +108,22 @@ func BrokerIngressDataPlaneTestHelper(
resources.WithSubscriberServiceRefForTrigger(loggerName),
)

st.Run("Ingress supports OPTIONS", func(t *testing.T) {
// TODO(evana): check "Allow" header and other options.
// This may be simpler if the setup requires a local HTTP proxy which can reach into the cluster.
method := sender.WithMethod("OPTIONS")
responseSink := "http://" + client.GetServiceHost(loggerName)
responseForward := sender.WithResponseSink(responseSink)
senderName := "options-test-sender"
client.SendRequestToAddressable(ctx, senderName, broker.Name, testlib.BrokerTypeMeta, map[string]string{}, "", method, responseForward)
client.WaitForResourceReadyOrFail(senderName, &podMeta)
eventTracker.AssertAtLeast(1, recordevents.MatchEvent(cetest.AllOf(
cetest.AnyOf(
sender.MatchStatusCode(200), sender.MatchStatusCode(405)),
cetest.HasSource("https://knative.dev/eventing/test/event-sender"),
)))
})

client.WaitForResourceReadyOrFail(trigger.Name, testlib.TriggerTypeMeta)
st.Run("Ingress Supports CE0.3", func(t *testing.T) {
eventID := "CE0.3"
Expand Down

0 comments on commit 40924fd

Please sign in to comment.