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 27, 2020
1 parent fca0af0 commit 8cfd160
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 @@ -100,7 +100,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 @@ -119,7 +119,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 @@ -294,7 +294,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 @@ -310,8 +310,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 @@ -326,7 +326,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 @@ -338,7 +338,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 All @@ -354,7 +354,7 @@ func BrokerV1Beta1ConsumerDataPlaneTestHelper(
client.WaitForResourceReadyOrFail(transformTrigger.Name, testlib.TriggerTypeMeta)

client.WaitForResourceReadyOrFail(replyTrigger.Name, testlib.TriggerTypeMeta)
client.SendEventToAddressable(replySource+"-sender", broker.Name, testlib.BrokerTypeMeta, event)
client.SendEventToAddressable(replySource+"-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 8cfd160

Please sign in to comment.