Timur created FLINK-21324:
-----------------------------
Summary: statefun-testutil can't assert messages function sends to itself
Key: FLINK-21324
URL:
https://issues.apache.org/jira/browse/FLINK-21324 Project: Flink
Issue Type: Bug
Components: Stateful Functions
Affects Versions: statefun-2.2.2
Reporter: Timur
Assertions don't work for messages sent by functions to themselves. The reason is that TestContext doesn't add a message to responses:
{code:java}
@Override
public void send(Address to, Object message) {
if (to.equals(selfAddress)) {
messages.add(new Envelope(self(), to, message));
return;
}
responses.computeIfAbsent(to, ignore -> new ArrayList<>()).add(message);
}
{code}
Instead of adding the message to responses the method returns right after message added to messages.
Here is the example of the assertion that doesn't work in case a function sent a message to itself:
{code:java}
assertThat(harness.invoke(aliceDiseaseDiagnosedEvent()), sentNothing());
{code}
The test won't fail even though the message was really sent.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)