Skip to content

Error serializing Avro response message when using the Test Binder #3146

@tamamico

Description

@tamamico

Describe the issue
Im trying to use Spring Cloud Stream test binder to speed up my integration tests (I'm currently using Testcontainers and everything is working fine, but the startup time is slow). However, when using the test binder there is a weird behavior when serializing the output message, because even if it's well generated and everything seems to work well, the byte array with the payload only contains part of the message. I provide you a link to my GitHub repository with the sample code to reproduce the issue.

It seems that, when building the byte array from the response message, for a reason I'm not able to find the outgoing byte array misses data, because the incoming payload is correct but the written bytes don't match it.

Can you help me in solving this issue, or point me in the right direction to fix it? As soon as you provide me clues about where is the root cause, I'm happy to contribute with the fix to it if needed, but for now I only was able to find where the problem comes from, but not how can I fix it.

Thank you very much for your time!

To Reproduce
Steps to reproduce the behavior:

  1. If you run GreeterTestcontainersTest class, the test will work well
  2. If you run GreeterTestbindersTest, you will currently see an error because of a bad header when decoding the response. As you can see in the logs, the received payload only contains the value inside message field on the response object with an unknown prefix byte instead of the complete response object, causing the decoding error.

Version of the framework
4.3.0
Expected behavior
When receiving the response payload as a byte array, I should be able to build my output object by using
Screenshots

Additional context
GitHub repository with code sample to reproduce the issue: https://github.com/tamamico/poc-spring-cloud-stream-native.git

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions