Skip to content

Commit

Permalink
Add explicit content encoding to event-senders in broker conf test
Browse files Browse the repository at this point in the history
Realted: #3791

For broker data plane conformance tests, when observing some of the
errors in pod sender logs, the following message was seen:

"Got response from http://broker-ingress.knative-eventing-28b9ei2f23.svc.cluster.local/test-broker-v1-beta1-data-plane-consumer-wzjjv/br
failed to convert response into event: unknown Message encoding"

Add a `sender.WithEncoding(ce.EncodingStructured)` option to the event
sender in an attempt to make the conformance tests more robust.
  • Loading branch information
lberk committed Aug 19, 2020
1 parent 9f3fb3f commit 7fc23fc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/conformance/helpers/broker_data_plane_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func BrokerV1Beta1IngressDataPlaneTestHelper(
}
event.Context.AsV03()
event.SetSpecVersion("0.3")
client.SendEventToAddressable("v03-test-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable("v03-test-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
originalEventMatcher := recordevents.MatchEvent(cetest.AllOf(
cetest.HasId(eventID),
cetest.HasSpecVersion("0.3"),
Expand All @@ -110,7 +110,7 @@ func BrokerV1Beta1IngressDataPlaneTestHelper(
t.Fatalf("Cannot set the payload of the event: %s", err.Error())
}

client.SendEventToAddressable("v10-test-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable("v10-test-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
originalEventMatcher := recordevents.MatchEvent(cetest.AllOf(
cetest.HasId(eventID),
cetest.HasSpecVersion("1.0"),
Expand Down Expand Up @@ -260,7 +260,7 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
event := baseEvent
id := "identical-attibutes"
event.SetID(id)
client.SendEventToAddressable(id+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable(id+"-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
originalEventMatcher := recordevents.MatchEvent(
cetest.HasId(id),
cetest.HasType(testlib.DefaultEventType),
Expand All @@ -276,8 +276,8 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
event.SetSource(source)
secondEvent := baseEvent

client.SendEventToAddressable("first-"+source+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable("second-"+source+"-sender", broker.Name, testlib.BrokerTypeMeta, secondEvent)
client.SendEventToAddressable("first-"+source+"-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
client.SendEventToAddressable("second-"+source+"-sender", broker.Name, testlib.BrokerTypeMeta, secondEvent, sender.WithEncoding(ce.EncodingStructured))
filteredEventMatcher := recordevents.MatchEvent(
cetest.HasSource(source),
)
Expand All @@ -292,7 +292,7 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
event := baseEvent
source := "filtered-event"
event.SetSource(source)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
filteredEventMatcher := recordevents.MatchEvent(
cetest.HasSource(source),
)
Expand All @@ -304,7 +304,7 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
event := baseEvent
source := "delivery-check"
event.SetSource(source)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
originalEventMatcher := recordevents.MatchEvent(
cetest.HasSource(source),
)
Expand Down Expand Up @@ -338,7 +338,7 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
resources.WithSubscriberServiceRefForTriggerV1Beta1(loggerName),
)
client.WaitForResourceReadyOrFail(replyTrigger.Name, testlib.TriggerTypeMeta)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable(source+"-sender", broker.Name, testlib.BrokerTypeMeta, event, sender.WithEncoding(ce.EncodingStructured))
transformedEventMatcher := recordevents.MatchEvent(
cetest.HasSource("reply-check-source"),
cetest.HasType("reply-check-type"),
Expand Down

0 comments on commit 7fc23fc

Please sign in to comment.