-
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
We have a series of tests that boil down to the following:
mockProvider.
AddAsynchronousMessage().
Given("something happens").
ExpectsToReceive("a notification").
WithContent("application/json", eventJSON).
ConsumedBy(handleWrapper).
Verify(t)We have had some of them intermittently failing. The consumer function (or Pact, if we use AsType) is unable to parse the AsynchronousMessage.Contents, usually failing with an error similar to invalid character '\x01' after top-level value.
In one particularly interesting case, we found that there was a complete SQL statement included in the message contents.
I think the root cause of the problem lies in Message.WithContents, which seems to assume that a byte slice can be safely cast to a *C.char. As far as I know, Go makes no guarantees that a slice is NUL terminated.
Metadata
Metadata
Assignees
Labels
No labels